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

Incorrect test file path printed when multiple targets are supplied #817

Open
schooler-hpe opened this issue Nov 1, 2022 · 2 comments
Open

Comments

@schooler-hpe
Copy link

I originally submitted this as a pytest issue but they suggested that I report it here instead.

In each of two directories, I have one Tavern test file that will run with pytest:

C02VF3KDHTD8:api schooler$ ls 2-disruptive/test_hardware_negative.tavern.yaml 3-destructive/test_components.tavern.yaml
2-disruptive/test_hardware_negative.tavern.yaml	3-destructive/test_components.tavern.yaml

When I execute them both with one invocation, the summary output shows an incorrect test file path.

C02VF3KDHTD8:api schooler$ python3 -m pytest 2-disruptive/ 3-destructive/
========================================================================================================== test session starts ===========================================================================================================
platform darwin -- Python 3.9.13, pytest-7.1.2, pluggy-1.0.0
rootdir: <REDACTED>, configfile: pytest.ini
plugins: tavern-1.23.3
collected 2 items

2-disruptive/test_hardware_negative.tavern.yaml .                                                                                                                                                                                  [ 50%]
2-disruptive/test_components.tavern.yaml .                                                                                                                                                                                         [100%]

=========================================================================================================== 2 passed in 5.74s ============================================================================================================

The summary output should show 3-destructive/test_components.tavern.yaml as the last test and not 2-disruptive/test_components.tavern.yaml which doesn't exist.

Additional comment from the pytest thread that was closed: "I suggest to report this in the tavern repository, as I suspect there might be an issue on how they are creating the test items."

@michaelboulton
Copy link
Member

It's definitely possible that it's using the wrong folder name but I can't see how, the code is in the tavern/testutils/pytesthook/file.py file but at a glance it seems to be doing the right thing

@michaelboulton
Copy link
Member

I can't reproduce this locally

$ ls subfolder_*
subfolder_1:
test_auth_key.tavern.yaml

subfolder_2:
test_auth_key.tavern.yaml
$ py.test subfolder_*
...
subfolder_1/test_auth_key.tavern.yaml::Test 1 PASSED
subfolder_2/test_auth_key.tavern.yaml::Test 2 PASSED
$ py.test subfolder_* --collect-only
...
<YamlFile tests/integration/subfolder_1/test_auth_key.tavern.yaml>
  /home/michael/code/tavern/tests/integration/subfolder_1/test_auth_key.tavern.yaml
  <YamlItem Test 1>
    Test 1:
    1: Test stage
<YamlFile tests/integration/subfolder_2/test_auth_key.tavern.yaml>
  /home/michael/code/tavern/tests/integration/subfolder_2/test_auth_key.tavern.yaml
  <YamlItem Test 2>
    Test 2:
    1: Test stage

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

No branches or pull requests

2 participants