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

Tests are not executed when using --dead-fixtures #20

Open
sobolevn opened this issue Apr 28, 2018 · 5 comments
Open

Tests are not executed when using --dead-fixtures #20

sobolevn opened this issue Apr 28, 2018 · 5 comments

Comments

@sobolevn
Copy link
Contributor

As I have already mentioned in #16 (comment) 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
@jllorencetti
Copy link
Owner

Oh, now I see, I thought you were expecting 51 items to be collected.
Not running the tests is expected for --dead-fixtures, "by design".
I'll update the docs to make it clear, at least for now.
What you could do is add it as an extra step in your build process, like this.

@sobolevn
Copy link
Contributor Author

@jllorencetti oh, that's a surprise for me.

Could you please explain this design decision?
Current behavior makes the process a lot less pleasant.

@jllorencetti
Copy link
Owner

jllorencetti commented 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.

@jllorencetti jllorencetti reopened this Apr 28, 2018
@jllorencetti jllorencetti changed the title Incorrect test count Tests are not executed when using --dead-fixtures Apr 28, 2018
@sobolevn
Copy link
Contributor Author

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?

@jllorencetti
Copy link
Owner

@sobolevn looks good to me. Thanks! :)

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

No branches or pull requests

2 participants