anapaulagomes / pytest-picked

Run the tests related to the changed files (according to Git) 🤓
MIT License
368 stars 16 forks source link

Fix PytestDeprecationWarning: TerminalReporter.writer #78

Closed anapaulagomes closed 4 years ago

anapaulagomes commented 4 years ago

To reproduce it, run pytest in this repo:

tests/test_pytest_picked.py: 13 tests with warnings
  /home/ana/workspace/pytest-picked/venv/lib/python3.8/site-packages/pytest-5.4.1-py3.8.egg/_pytest/terminal.py:287: PytestDeprecationWarning: TerminalReporter.writer attribute is deprecated, use TerminalReporter._tw instead at your own risk.
  See https://docs.pytest.org/en/latest/deprecations.html#terminalreporter-writer for more information.
    warnings.warn(

-- Docs: https://docs.pytest.org/en/latest/warnings.html
ggarber42 commented 4 years ago

Hello there,

I'm a complete newbie to open source, but I saw the good first issue label and decided to give it a try. So, I've downloaded the reṕository, created a virtual environment and installed pytest.

Then I tried to to reproduce the issue running pytest tests/test_pytest_picked.py

But the test actually run without the deprecation warning:

Screenshot from 2020-09-01 21-59-34

Certainly I've missed something, could you tell if there is anything missing? Also, if you need more images, just tell me.

Thanks a lot!

anapaulagomes commented 4 years ago

Hi @ggarber42,

Welcome to the project. :) Always good to have new people on board!

So, have you tried to install the plugin locally? If not, try running python setup.py develop and run the tests again. Let me know how it goes.

ggarber42 commented 4 years ago

Hi @anapaulagomes,

Thanks for the reply!!!

So, I've tried python setup.py develop and even though the output was different than last time, it didn't run the deprecation warning again. Also, I've tried run this command within and without a virtual environment.

I will list my commands below and also paste an image with the output (I've put the git clone, just to show that there was nothing else between the clone and the test command)

$ git clone https://github.com/anapaulagomes/pytest-picked.git $ code pytest-picked/ $ python3 setup.py develop $ pytest tests/test_pytest_picked.py

Screenshot from 2020-09-05 11-40-24

Nevertheless, using the virtualenv the result was the same, and the command list almost the same. The difference was that I've setup the virtualenv in between.

So, I guess I've missed something, probably is config stuff again. Anyway, if it's not clear for you why I can't reproduce, I can put more info.

Thanks again

anapaulagomes commented 4 years ago

Actually, the warning was removed in Pytest 6.0.0. We updated it last month. Sorry, @ggarber42, I just saw it: https://docs.pytest.org/en/latest/deprecations.html#terminalreporter-writer

TerminalReporter.writer Removed in version 6.0.

This plugin uses version 6.0.1. I'm going to close this issue since this isn't a problem anymore (also, I've checked the code and we are not calling it directly). Thanks for checking it anyways!