Code: Select all
broker/
broker/tests
broker/tests/conftest.py
broker/tests/test_db.py
broker/db.py
Ich konfiguriere Pycharm so, dass Pytest als Testläufer verwendet wird. Wenn ich test_db.py in Pycharm ausführe, erhalte ich Folgendes:
Code: Select all
/Users/cbogdon/virtualenv/platinum-onboard/bin/python /Users/cbogdon/coding/platinum-onboard/broker/tests/test_db.py
Process finished with exit code 0
Wenn ich es in der Befehlszeile ausführe mit:
Code: Select all
python -m pytest --setup-show tests/test_db.py
Code: Select all
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 =
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 ==================================================
Mobile version