Trouble with pytest -m connection

I was following #M220P course and all went well until I had to “pytest” it.
I’m using a Ubuntu 18.04 server in AWS to do that.
I was succesful in connecting my browser to the page mflix generated by run.py. (so I clearly can connect to Atlas DB)
This is what I’m seeing when “pytest -m connection” is isued

Error Message

================================================================================= test session starts =================================================================================
platform linux – Python 3.6.8, pytest-3.3.0, py-1.8.0, pluggy-0.6.0
rootdir: /python/M220P, inifile:
plugins: flask-0.10.0
collected 0 items / 1 errors

======================================================================================= ERRORS ========================================================================================
__________________________________________________________________________________ ERROR collecting __________________________________________________________________________________
lib/python3.6/site-packages/_pytest/config.py:327: in _getconftestmodules
return self._path2confmods[path]
E KeyError: local(’/python/M220P/lib/python3.6/site-packages/notebook/tests/selenium’)

During handling of the above exception, another exception occurred:
lib/python3.6/site-packages/_pytest/config.py:358: in _importconftest
return self._conftestpath2mod[conftestpath]
E KeyError: local(’/python/M220P/lib/python3.6/site-packages/notebook/tests/selenium/conftest.py’)

During handling of the above exception, another exception occurred:
lib/python3.6/site-packages/_pytest/config.py:364: in _importconftest
mod = conftestpath.pyimport()
lib/python3.6/site-packages/py/_path/local.py:701: in pyimport
import(modname)
lib/python3.6/site-packages/pytest/assertion/rewrite.py:212: in load_module
py.builtin.exec
(co, mod.dict)
lib/python3.6/site-packages/notebook/tests/selenium/conftest.py:4: in
import requests
E ModuleNotFoundError: No module named ‘requests’

During handling of the above exception, another exception occurred:
lib/python3.6/site-packages/py/_path/common.py:377: in visit
for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
lib/python3.6/site-packages/py/_path/common.py:429: in gen
for p in self.gen(subdir):
lib/python3.6/site-packages/py/_path/common.py:429: in gen
for p in self.gen(subdir):
lib/python3.6/site-packages/py/_path/common.py:429: in gen
for p in self.gen(subdir):
lib/python3.6/site-packages/py/_path/common.py:429: in gen
for p in self.gen(subdir):
lib/python3.6/site-packages/py/_path/common.py:429: in gen
for p in self.gen(subdir):
lib/python3.6/site-packages/py/_path/common.py:418: in gen
dirs = self.optsort([p for p in entries
lib/python3.6/site-packages/py/_path/common.py:419: in
if p.check(dir=1) and (rec is None or rec§)])
lib/python3.6/site-packages/_pytest/main.py:723: in _recurse
ihook = self.gethookproxy(path)
lib/python3.6/site-packages/_pytest/main.py:627: in gethookproxy
my_conftestmodules = pm._getconftestmodules(fspath)
lib/python3.6/site-packages/_pytest/config.py:341: in _getconftestmodules
mod = self._importconftest(conftestpath)
lib/python3.6/site-packages/_pytest/config.py:366: in _importconftest
raise ConftestImportFailure(conftestpath, sys.exc_info())
E _pytest.config.ConftestImportFailure: ModuleNotFoundError(“No module named ‘requests’”,)
E File "/python/M220P/lib/python3.6/site-packages/pytest/assertion/rewrite.py", line 212, in load_module
E py.builtin.exec
(co, mod.dict)
E File “/python/M220P/lib/python3.6/site-packages/notebook/tests/selenium/conftest.py”, line 4, in
E import requests
!!! Interrupted: 1 errors during collection !!!
=============================================================================== 1 error in 3.18 seconds ===============================================================================

What should I do to pass the lab?

I think the requests Python-Module is not installed.

Try running pip3 install requests command on your EC2 instance command line terminal.

Please reply if it helped.

1 Like

It was installed.
But never mind, I’m able to do the LABs without it :wink: