Skip to content

Internal error when using -m option ending in forward slash #4051

@boustrophedon

Description

@boustrophedon

I accidentally stumbled upon this bug when I used -m instead of --pyargs in one of my projects:
https://gist.github.com/boustrophedon/338a6572e52d6d44c9175783e9657209

Environment: Linux, Python 3.7 and Pytest 3.8.1 both via pipenv

To reproduce, create a directory structure that looks like:

repro_case/
repro_case/a/
repro_case/a/test_a.py

The contents of "a/test_a.py" are

def test_a():
  pass

In the repro_case directory, running pytest by itself passes the trivial test, but running pytest -m a/ crashes and produces the linked error.

The crash does not occur if there is no test_a.py file, or if the test_a.py file is empty.

pip list inside the virtualenv produces:
Package Version


atomicwrites 1.2.1
attrs 18.2.0
more-itertools 4.3.0
pip 18.0
pluggy 0.7.1
py 1.6.0
pytest 3.8.1
setuptools 40.4.3
six 1.11.0
wheel 0.31.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueeasy issue that is friendly to new contributortopic: reportingrelated to terminal output and user-facing messages and errorstype: enhancementnew feature or API change, should be merged into features branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions