I'm new to pytest and am trying to write testing modules for my application. My directory structure is:
broker/ broker/tests broker/tests/conftest.py broker/tests/test_db.py broker/db.py I want to test the db.py module.
I configure pycharm to use pytest as my test runner. When I run the test_db.py in pycharm I get:
/Users/cbogdon/virtualenv/platinum-onboard/bin/python /Users/cbogdon/coding/platinum-onboard/broker/tests/test_db.py Process finished with exit code 0 It's almost like pycharm is not executing the pytest. Even if I right click on the green arrow to the left of one of my testing functions a menu appears and shows I can click: "Run 'pytest for test_db.py::TestDBFunctions::test_valid_db'"
If I run it at the command line using:
python -m pytest --setup-show tests/test_db.py I get the appropriate test output.
python -m pytest --setup-show tests/test_db.py ========================================================== test session starts =========================================================== platform darwin -- Python 3.6.1, pytest-4.1.1, py-1.7.0, pluggy-0.8.1 rootdir: /Users/cbogdon/coding/platinum-onboard/broker, inifile: collected 4 items tests/test_db.py tests/test_db.py::TestDBFunctions::test_uuid. tests/test_db.py::TestDBFunctions::test_invalid_dbF tests/test_db.py::TestDBFunctions::test_valid_db. tests/test_db.py::TestDBFunctions::test_already_created_database. ================================================================ FAILURES ================================================================ ____________________________________________________ TestDBFunctions.test_invalid_db _____________________________________________________ self = <test_db.TestDBFunctions object at 0x102606438> def test_invalid_db(self): > ret = db.initialize_database() E TypeError: initialize_database() missing 1 required positional argument: 'dbname' tests/test_db.py:14: TypeError =================================================== 1 failed, 3 passed in 0.08 seconds ================================================== Is there something special I need to do in PyCharm?
Sorry for the newbie question, but I just can't figure this out one bit!

