[Pytest-commit] Issue #618: Generating runtests.py for Python 2.6 is failing althout argparse exists (hpk42/pytest)

Dinu Gherman issues-reply at bitbucket.org
Wed Oct 22 10:03:51 CEST 2014


New issue 618: Generating runtests.py for Python 2.6 is failing althout argparse exists
https://bitbucket.org/hpk42/pytest/issue/618/generating-runtestspy-for-python-26-is

Dinu Gherman:

Using py.test 2.6.3 I try the follwowing in order to generate a `runtests.py` file as described on http://pytest.org/latest/goodpractises.html?highlight=test_suite, but the `argparse` package cannot be found although it is installed.

```
#!bash

$ py.test-2.7 --genscript=runtests.py
WARNING: generated script will not run on python2.6 due to 'argparse' dependency. Use python2.6 to generate a python2.6 compatible script
generated pytest standalone script: /Users/dinu/myproject/runtests.py

$ py.test-2.6 --genscript=runtests.py
generated script will run on python2.6-python3.3++
Traceback (most recent call last):
  File "/opt/bin/py.test-2.6", line 8, in <module>
    load_entry_point('pytest==2.6.3', 'console_scripts', 'py.test-2.6')()
  File "/opt/lib/python2.6/site-packages/pytest-2.6.3-py2.6.egg/_pytest/config.py", line 41, in main
    return config.hook.pytest_cmdline_main(config=config)
  File "/opt/lib/python2.6/site-packages/pytest-2.6.3-py2.6.egg/_pytest/core.py", line 413, in __call__
    return self._docall(methods, kwargs)
  File "/opt/lib/python2.6/site-packages/pytest-2.6.3-py2.6.egg/_pytest/core.py", line 424, in _docall
    res = mc.execute()
  File "/opt/lib/python2.6/site-packages/pytest-2.6.3-py2.6.egg/_pytest/core.py", line 315, in execute
    res = method(**kwargs)
  File "/opt/lib/python2.6/site-packages/pytest-2.6.3-py2.6.egg/_pytest/genscript.py", line 82, in pytest_cmdline_main
    deps,
  File "/opt/lib/python2.6/site-packages/pytest-2.6.3-py2.6.egg/_pytest/genscript.py", line 54, in generate_script
    data = compress_packages(packages)
  File "/opt/lib/python2.6/site-packages/pytest-2.6.3-py2.6.egg/_pytest/genscript.py", line 50, in compress_packages
    mapping.update(pkg_to_mapping(name))
  File "/opt/lib/python2.6/site-packages/pytest-2.6.3-py2.6.egg/_pytest/genscript.py", line 28, in pkg_to_mapping
    toplevel = find_toplevel(name)
  File "/opt/lib/python2.6/site-packages/pytest-2.6.3-py2.6.egg/_pytest/genscript.py", line 21, in find_toplevel
    raise LookupError(name)
LookupError: argparse

$ python2.6 -m argparse

$
```




More information about the pytest-commit mailing list