pytest-dev / pytest-runner

MIT License
56 stars 21 forks source link

pytest-runner doesn't support dry run option #38

Closed sparkiegeek closed 6 years ago

sparkiegeek commented 6 years ago

platform linux -- Python 3.6.3, pytest-3.1.3, py-1.4.34, pluggy-0.4.0

$ ./setup.py --dry-run test 
running pytest
-✂ for brevity ✂-
Traceback (most recent call last):
  File "./setup.py", line 22, in <module>
    'git-lp-propose=gitlptools:git_lp_propose'],
  File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/path/to/project/.eggs/pytest_runner-3.0-py3.6.egg/ptr.py", line 195, in run
  File "/usr/lib/python3.6/distutils/cmd.py", line 103, in __getattr__
    raise AttributeError(attr)
AttributeError: result_code
$ cat setup.cfg
[aliases]
test=pytest
jaraco commented 6 years ago

Do you think it should? I see the setuptools test command does, so I guess pytest-runner could. What led you to passing this option? What was your expectation?

jaraco commented 6 years ago

Here's what I ran, replicating your findings:

$ cat > setup.py              
__import__('setuptools').setup(name='mypkg', version='1')
$ python setup.py --dry-run test
running test
$ rwt pytest-runner -- setup.py --dry-run pytest
Collecting pytest-runner
  Downloading pytest_runner-3.0-py2.py3-none-any.whl
Installing collected packages: pytest-runner
Successfully installed pytest-runner-3.0
running pytest
Traceback (most recent call last):
  File "setup.py", line 1, in <module>
    __import__('setuptools').setup(name='mypkg', version='1')
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/rwt-p2xhztoe/ptr.py", line 195, in run
    if self.result_code:
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/cmd.py", line 103, in __getattr__
    raise AttributeError(attr)
AttributeError: result_code
jaraco commented 6 years ago

I see that pytest-runner does already have support for dry-run. It just fails.

Tracing the creation of that result_code, I see it was added in 840ff4c2bf. I don't think it's ever been used.

jaraco commented 6 years ago

Released as 3.0.1.