Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.8: error: unrecognized arguments: -rs #5536

Closed
4 tasks done
hugovk opened this issue Jul 2, 2019 · 4 comments
Closed
4 tasks done

Python 3.8: error: unrecognized arguments: -rs #5536

hugovk opened this issue Jul 2, 2019 · 4 comments

Comments

@hugovk
Copy link
Member

hugovk commented Jul 2, 2019

  • a detailed description of the bug or suggestion
  • output of pip list from the virtual environment you are using
  • pytest and operating system versions
  • minimal example if possible
  • pytest 5.0.0
  • Ubuntu 16.04.6 LTS Xenial

pytest -rs errors on on Travis CI with Python 3.8-dev and nightly (both currently Python 3.8.0b1+).

Python 2.7, 3.5-3.7, PyPy and PyPy3 work as expected.

pytest --help on -rs:

  -r chars              show extra test summary info as specified by chars:
                        (f)ailed, (E)rror, (s)kipped, (x)failed, (X)passed,
                        (p)assed, (P)assed with output, (a)ll except passed
                        (p/P), or (A)ll. (w)arnings are enabled by default
                        (see --disable-warnings).

It doesn't really matter what's in the test file:

#!/usr/bin/env python
import pytest

def test_ok():
    assert True

@pytest.mark.skip(reason="skip it")
def test_skip():
    assert False

Run it with -rs on Python 3.7:

$ pytest -rs test.py
============================= test session starts ==============================
platform linux -- Python 3.7.1, pytest-5.0.0, py-1.7.0, pluggy-0.12.0
rootdir: /home/travis/build/hugovk/test
collected 2 items
test.py .s                                                               [100%]
=========================== short test summary info ============================
SKIPPED [1] test.py:9: skip it
===================== 1 passed, 1 skipped in 0.02 seconds ======================
The command "pytest -rs test.py" exited with 0.

But errors on Python 3.8:

$ pytest -rs test.py
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: -rs
  inifile: None
  rootdir: /home/travis/build/hugovk/test
The command "pytest -rs test.py" exited with 4.

Python 3.7:

$ pip list
Package            Version   
------------------ ----------
atomicwrites       1.2.1     
attrs              18.2.0    
certifi            2018.11.29
importlib-metadata 0.18      
mock               2.0.0     
more-itertools     4.3.0     
nose               1.3.7     
numpy              1.15.4    
packaging          19.0      
pbr                5.1.1     
pip                19.0.3    
pipenv             2018.11.26
pluggy             0.12.0    
py                 1.7.0     
pyparsing          2.4.0     
pytest             5.0.0     
setuptools         40.8.0    
six                1.11.0    
virtualenv         16.1.0    
virtualenv-clone   0.4.0     
wcwidth            0.1.7     
wheel              0.33.1    
zipp               0.5.1     

Python 3.8-dev:

$ pip list
Package            Version            
------------------ -------------------
atomicwrites       1.3.0              
attrs              19.1.0             
certifi            2019.6.16          
Cython             0.29.11            
importlib-metadata 0.18               
mock               3.0.5              
more-itertools     7.1.0              
nose               1.3.7              
numpy              1.18.0.dev0+b4105bf
packaging          19.0               
pip                19.1.1             
pipenv             2018.11.26         
pluggy             0.12.0             
py                 1.8.0              
pyparsing          2.4.0              
pytest             5.0.0              
pytz               2019.1             
setuptools         41.0.1             
six                1.12.0             
virtualenv         16.6.1             
virtualenv-clone   0.5.3              
wcwidth            0.1.7              
wheel              0.33.4             
zipp               0.5.1              
@hugovk
Copy link
Member Author

hugovk commented Jul 2, 2019

Aha, just found this is a duplicate of the already fixed #5523 :)

And a workaround in the meantime:

-  - pytest -rs test.py
+  - pytest -r s test.py

https://travis-ci.org/hugovk/test/builds/553161541

Thanks!

@hugovk hugovk closed this as completed Jul 2, 2019
@RonnyPfannschmidt
Copy link
Member

@hugovk you missed the - before the s

@hugovk
Copy link
Member Author

hugovk commented Jul 2, 2019

The s is an option for the -r:

$ pytest -r -s test.py
ERROR: usage: pytest.py [options] [file_or_dir] [file_or_dir] [...]
pytest.py: error: argument -r: expected one argument
$ pytest -r s test.py
======================================================= test session starts =======================================================
platform darwin -- Python 3.7.3, pytest-5.0.0, py-1.5.4, pluggy-0.12.0
Test order randomisation NOT enabled. Enable with --random-order or --random-order-bucket=<bucket_type>
rootdir: /Users/hugo/github/test, inifile: setup.cfg
plugins: xdist-1.29.0, parallel-0.0.9, random-order-1.0.4, flaky-3.5.3, black-0.3.5, timeout-1.3.3, rerunfailures-6.0, cov-2.7.1, forked-1.0.1, requests-mock-1.6.0
collected 2 items

test.py .s                                                                                                                  [100%]
===Flaky Test Report===


===End Flaky Test Report===

===================================================== short test summary info =====================================================
SKIPPED [1] test.py:9: skip it
=============================================== 1 passed, 1 skipped in 0.05 seconds ===============================================
$ pytest -rs test.py # This doesn't work on 3.8 (yet)
======================================================= test session starts =======================================================
platform darwin -- Python 3.7.3, pytest-5.0.0, py-1.5.4, pluggy-0.12.0
Test order randomisation NOT enabled. Enable with --random-order or --random-order-bucket=<bucket_type>
rootdir: /Users/hugo/github/test, inifile: setup.cfg
plugins: xdist-1.29.0, parallel-0.0.9, random-order-1.0.4, flaky-3.5.3, black-0.3.5, timeout-1.3.3, rerunfailures-6.0, cov-2.7.1, forked-1.0.1, requests-mock-1.6.0
collected 2 items

test.py .s                                                                                                                  [100%]
===Flaky Test Report===


===End Flaky Test Report===

===================================================== short test summary info =====================================================
SKIPPED [1] test.py:9: skip it
=============================================== 1 passed, 1 skipped in 0.04 seconds ==============================================

@RonnyPfannschmidt
Copy link
Member

sorry, my mistake, i missed that the option was -r

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants