pytest: Quotation marks in pytest command collects duplicate tests

  • a detailed description of the bug or suggestion Extra single or double quotation marks (‘’ or “”) in pytest command results in duplicate tests in pytest run

  • pip list

Package            Version
------------------ -------
attrs              19.3.0 
importlib-metadata 1.6.0  
more-itertools     8.2.0  
packaging          20.3   
pip                20.0.2 
pkg-resources      0.0.0  
pluggy             0.13.1 
py                 1.8.1  
pyparsing          2.4.6  
pytest             5.4.1  
setuptools         46.1.3 
six                1.14.0 
wcwidth            0.1.9  
wheel              0.34.2 
zipp               3.1.0  
  • pytest and operating system versions
pytest             5.4.1  
Description:	Debian GNU/Linux 10 (buster)
Release:	10
Codename:	buster
  • minimal example if possible
# tests.py
def test_01():
    pass
pytest --collect-only tests.py ""
============================================================================= test session starts =============================================================================
platform linux -- Python 3.7.3, pytest-5.4.1, py-1.8.1, pluggy-0.13.1
rootdir: /home/mikko/sandbox/pytest
collected 2 items                                                                                                                                                             
<Module tests.py>
  <Function test_01>
<Module tests.py>
  <Function test_01>

============================================================================ no tests ran in 0.01s ============================================================================

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 19 (19 by maintainers)

Commits related to this issue

Most upvoted comments

Sounds good. Today or tomorrow I will submit a PR addressing it.