Thanks to visit codestin.com
Credit goes to github.com

Skip to content

-c flag produces the wrong root dir #8464

@elbehery95

Description

@elbehery95

Scenario tested

tests/
       test.py
pytest.ini
pytest2.ini

The contents of test.py

from pathlib import Path

def test_root(pytestconfig):
    assert Path(pytestconfig.rootpath).resolve().absolute() == Path('.').resolve().absolute()

pytest.ini and pytest2.ini are the same

  • When running pytest tests/ the test is passing (correct rootdir is printed): rootdir: D:\pytest, configfile: pytest.ini
  • When running pytest tests/ -c pytest2.ini the test is failing (wrong rootdir and config are reported) : rootdir: D:\pytest\tests, configfile: ..\pytest2.ini

Please let me know if I can submit a fix for this :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: configrelated to config handling, argument parsing and config filetype: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions