- Newest
- Most votes
- Most comments
Currently, you cannot integrate "pytest" in Cloud9 IDE as we can in pycharm IDE under default test runner. Having said that, we can still write the "pytest" test and run them manually by using command : python -m pytest -vv <test_file_name>.py
For example please consider below :
"hello.py" - simply has two functions which returns strings "hi" and "bye" -
def hello():
return "hi"
def bye():
return "bye"
Then we write the tests for pytest "test_hello.py" -
from hello import *
def test_hello():
assert "hi" == hello()
def test_hello2():
assert "some" == hello()
def test_bye():
assert "bye" == bye()
Run test : python -m pytest -vv test_hello.py
======== test session starts ==============
platform linux -- Python 3.7.10, pytest-7.1.3, pluggy-1.0.0 -- /usr/bin/python3 cachedir: .pytest_cache rootdir: /home/ec2-user/environment collected 3 items
test_hello.py::test_helo PASSED [ 33%] test_hello.py::test_helo2 FAILED [ 66%] test_hello.py::test_bye PASSED [100%]
=============== FAILURES ==================
_________________ test_helo2 _____________________
def test_helo2():
assert "some" == helo()
E AssertionError: assert 'some' == 'hi' E - hi E + some
test_hello.py:7: AssertionError
============ short test summary info ================
Additionally, please refer [+} https://www.youtube.com/watch?v=IN4qt-9bMiE for detailed explanation on using pytest in cloud9 environment.
** Please note that third party link are only for reference purpose and AWS doesn't endorse them.
Further, please feel free to raise a case with AWS Premium Support for further assistance.
Relevant content
- asked 2 years ago
- asked 2 years ago
- AWS OFFICIALUpdated 23 days ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 3 months ago
I do run tests with the command line, but the ability to interactively debug tests is a huge downside to using Cloud9 as a primary IDE. The normal debugger in Cloud9 even with all it's faults and issues, still gives important functionality that any IDE should have, if only it could be extended to running & debugging tests.