python - Error using pytest tutorial -


i read unit-test brilliant feature write better code , assert features of target code stay same. wanted use it...

i using anaconda on linux machine.

i started using pytest working through manual's starter guide on homepage. after successful installation there appears first (unintended) error:

strpeter@linuxcomputer:~$ py.test  ================================================== test session starts =================================================== platform linux2 -- python 2.7.8 -- py-1.4.25 -- pytest-2.6.3 collected 0 items / 1 errors   ========================================================= errors ========================================================= ___________________________________________________ error collecting . ___________________________________________________ anaconda/lib/python2.7/site-packages/py/_path/common.py:331: in visit     x in visitor(fil, rec, ignore, bf, sort).gen(self): anaconda/lib/python2.7/site-packages/py/_path/common.py:377: in gen     p in self.gen(subdir): anaconda/lib/python2.7/site-packages/py/_path/common.py:377: in gen     p in self.gen(subdir): anaconda/lib/python2.7/site-packages/py/_path/common.py:377: in gen     p in self.gen(subdir): anaconda/lib/python2.7/site-packages/py/_path/common.py:377: in gen     p in self.gen(subdir): anaconda/lib/python2.7/site-packages/py/_path/common.py:367: in gen     if p.check(dir=1) , (rec none or rec(p))]) anaconda/lib/python2.7/site-packages/_pytest/main.py:628: in _recurse     ihook.pytest_collect_directory(path=path, parent=self) anaconda/lib/python2.7/site-packages/_pytest/main.py:166: in call_matching_hooks     plugins = self.config._getmatchingplugins(self.fspath) anaconda/lib/python2.7/site-packages/_pytest/config.py:688: in _getmatchingplugins     plugins += self._conftest.getconftestmodules(fspath) anaconda/lib/python2.7/site-packages/_pytest/config.py:521: in getconftestmodules     mod = self.importconftest(conftestpath) anaconda/lib/python2.7/site-packages/_pytest/config.py:554: in importconftest     self._onimport(mod) anaconda/lib/python2.7/site-packages/_pytest/config.py:674: in _onimportconftest     self.pluginmanager.consider_conftest(conftestmodule) anaconda/lib/python2.7/site-packages/_pytest/core.py:201: in consider_conftest     if self.register(conftestmodule, name=conftestmodule.__file__): anaconda/lib/python2.7/site-packages/_pytest/core.py:100: in register     reg(plugin, name) anaconda/lib/python2.7/site-packages/_pytest/config.py:613: in _register_plugin     call_plugin(plugin, "pytest_configure", {'config': self}) anaconda/lib/python2.7/site-packages/_pytest/core.py:265: in call_plugin     kwargs=kwargs, firstresult=true).execute() anaconda/lib/python2.7/site-packages/_pytest/core.py:315: in execute     res = method(**kwargs) anaconda/lib/python2.7/site-packages/astropy/tests/pytest_plugins.py:78: in pytest_configure     if not config.getoption('remote_data'): anaconda/lib/python2.7/site-packages/_pytest/config.py:836: in getoption     raise valueerror("no option named %r" % (name,)) e   valueerror: no option named u'remote_data'                                                      *not* commit!                                                      ================================================ 1 error in 2.77 seconds ================================================= 

i understand stupid error comes , how can resolve it. problem execute program py.test without filename , there no file called __init.py__? ok feeling stupid asking question please take question serious since found no hint in world wide web.

i have had issue. arises when run pytest wrong directory, e.g. wherever happen after installed it.

to solve,

  • create new directory , cd directory
  • create file test_sample.py in directory content per pytest tutorial
  • now run command pytest , see result shown in tutorial.

i'm new myself believe pytest searches directory structure run looking tests. run wrong place , you'll strange results if sees thinks might test.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -