question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tests are not executed when using --dead-fixtures

See original GitHub issue

As I have already mentioned in https://github.com/jllorencetti/pytest-deadfixtures/issues/16#issuecomment-385154686 this plugin breaks the test count in the output.

How it is now

It seams that this plugin breaks something related with the tests count. As we can clearly see that 16 tests were collected, but no tests ran.

============================= test session starts ==============================
platform linux -- Python 3.6.5, pytest-3.5.1, py-1.5.3, pluggy-0.6.0
rootdir: /home/travis/build/wemake-services/wemake-django-template, inifile: setup.cfg
plugins: isort-0.1.0, flake8-1.0.0, deadfixtures-2.0.1, cookies-0.3.0
collected 16 items                                                             
Cool, every declared fixture is being used.

========================= no tests ran in 0.02 seconds =========================
The command "pipenv run python -m pytest" exited with 0.

Link to the build: https://travis-ci.org/wemake-services/wemake-django-template/builds/372351651

How it should be

============================= test session starts ==============================
platform linux -- Python 3.6.5, pytest-3.5.1, py-1.5.3, pluggy-0.6.0
rootdir: /home/travis/build/wemake-services/wemake-django-template, inifile: setup.cfg
plugins: isort-0.1.0, flake8-1.0.0, deadfixtures-2.0.0, cookies-0.3.0
collected 16 items                                                             
Cool, every declared fixture is being used.

....
========================= 4 tests ran in 0.02 seconds =========================
The command "pipenv run python -m pytest" exited with 0.

Env

Here’re my exact versions:

  • python: 3.6.5,
  • pytest: ==3.5.1
  • pytest-deadfixtures: ==2.0.1

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sobolevncommented, Apr 28, 2018

So, can I make this change?

I see it to be like this:

  1. When running with --dead-fixtures tests are collected and executed as usual
  2. If some dead fixtures are found, tests fail with exit code 1
  3. When running with --dup-fixtures tests are collected and executed as usual
  4. If some duplicate fixtures are found, tests fail with exit code 1

I guess 2 and 4 should be executed as soon as possible, so we don’t have to waste users time on actually running any tests.

@jllorencetti what do you think?

1reaction
jllorencetticommented, Apr 28, 2018

@sobolevn when I first created the plugin I wasn’t expecting it to be used for other people so I made it fit my particular workflow. Makes sense to leave this issue open, but I won’t be able to take a look at it right now, so I’ll at a note about this behavior in the docs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pytest-deadfixtures - PyPI
A simple plugin to list unused or duplicated fixtures in a pytest suite. Features. List unused fixtures in your tests. List duplicated fixtures ......
Read more >
Test is not executed when pytest.fixture is used - Stack Overflow
First of all, pytest.fixture is a decorator, so it is affecting the function below, and the right way to use it is to...
Read more >
pytest-deadfixtures - Bountysource
I have a python app with the following folder structure: ├── src └── tests ... When I run pytest --dead-fixtures tests/application/ I get...
Read more >
Testing Python Applications with Pytest
pytest --picked will collect all test modules that were newly created or changed but not yet committed in a Git repository and run...
Read more >
pytest Documentation - Read the Docs
Execute the test function with “quiet” reporting mode: ... By default, pytest will not show test durations that are too small (<0.005s) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found