I am trying to run it through PyCharm and I am getting the following key error,
Testing started at 22:42 …
C:\Users\Abhishek\M220P\mflix-python\venv\Scripts\python.exe “C:\Program Files\JetBrains\PyCharm Community Edition 2019.2\helpers\pycharm_jb_pytest_runner.py” --target test_projection.py::test_basic_country_search_db
Launching pytest with arguments test_projection.py::test_basic_country_search_db in C:\Users\Abhishek\M220P\mflix-python\tests
============================= test session starts =============================
platform win32 – Python 3.7.0, pytest-3.3.0, py-1.8.0, pluggy-0.6.0 – C:\Users\Abhishek\M220P\mflix-python\venv\Scripts\python.exe
cachedir: .cache
rootdir: C:\Users\Abhishek\M220P\mflix-python\tests, inifile:
plugins: flask-0.10.0
collecting … collected 1 item
test_projection.py::test_basic_country_search_db ERROR [100%]
test setup failed
request = <SubRequest ‘_configure_application’ for <Function ‘test_basic_country_search_db’>>
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x04644C50>
@pytest.fixture(autouse=True)
def _configure_application(request, monkeypatch):
"""Use `pytest.mark.options` decorator to pass options to your application
factory::
@pytest.mark.options(debug=False)
def test_something(app):
assert not app.debug, 'the application works not in debug mode!'
"""
if 'app' not in request.fixturenames:
return
app = request.getfuncargvalue('app')
…\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pytest_flask\plugin.py:109:
conftest.py:14: in app
app.config[‘SECRET_KEY’] = config[‘TEST’][‘SECRET_KEY’]
self = <configparser.ConfigParser object at 0x03DFFBD0>, key = ‘TEST’
def __getitem__(self, key):
if key != self.default_section and not self.has_section(key):
raise KeyError(key)
E KeyError: ‘TEST’
…\AppData\Local\Programs\Python\Python37-32\lib\configparser.py:958: KeyError
=================================== ERRORS ====================================
_______________ ERROR at setup of test_basic_country_search_db ________________
request = <SubRequest ‘_configure_application’ for <Function ‘test_basic_country_search_db’>>
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x04644C50>
@pytest.fixture(autouse=True)
def _configure_application(request, monkeypatch):
"""Use `pytest.mark.options` decorator to pass options to your application
factory::
@pytest.mark.options(debug=False)
def test_something(app):
assert not app.debug, 'the application works not in debug mode!'
"""
if 'app' not in request.fixturenames:
return
app = request.getfuncargvalue('app')
…\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pytest_flask\plugin.py:109:
conftest.py:14: in app
app.config[‘SECRET_KEY’] = config[‘TEST’][‘SECRET_KEY’]
self = <configparser.ConfigParser object at 0x03DFFBD0>, key = ‘TEST’
def __getitem__(self, key):
if key != self.default_section and not self.has_section(key):
raise KeyError(key)
E KeyError: ‘TEST’
…\AppData\Local\Programs\Python\Python37-32\lib\configparser.py:958: KeyError
=========================== 1 error in 0.21 seconds ===========================
Process finished with exit code 0
Assertion failed
Assertion failed
But i was able to run the integration test for this ticket.
Can someone please help me here to run the unit tests.
Thanks You!