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

Use pytest instead of nosetests #16883

Merged
merged 23 commits into from
Aug 6, 2020
Merged

Use pytest instead of nosetests #16883

merged 23 commits into from
Aug 6, 2020

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented Mar 6, 2020

What does this PR do?

Replaces nosetests with pytest.

Why is it important?

Nosetests has been in maintenance mode for years, its last release was done in 2015. When evolving the testing framework for Python tests it would be better to do it based on a maintained test tool. It will stop working with Python 3.9.

For #15891 I am considering adding new features to the testing framework that could include to add some plugin for the test tool, it wouldn't make sense to implement code based on a discontinued tool.

Pytest is a complete and well maintained test tool, it is one of the tools recommended after cease of nose project and it can be used as a direct replacement.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works

Author checklist

  • Interrupting tests with compose fails because compose tries to write to stderr and it is closed

Related issues

Nosetests has been in maintenance mode for years, its last release was
released in 2015. When evolving the testing framework for Python tests
it would be better to do it based on a maintained test tool.
@jsoriano jsoriano added in progress Pull request is currently in progress. [zube]: In Progress Team:Platforms Label for the Integrations - Platforms team labels Mar 6, 2020
@jsoriano jsoriano self-assigned this Mar 6, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-platforms (Team:Platforms)

@jsoriano
Copy link
Member Author

jsoriano commented Mar 9, 2020

Closing this by now.

@jsoriano
Copy link
Member Author

We have talked internally about this and we think that it worths to continue migrating out of nosetests even if we don't have any other immediate benefit. So I will continue with this change.

@andresrc
Copy link
Contributor

Can you create an issue focusing on the need to remove this because 3.9? Thanks!

@jsoriano
Copy link
Member Author

Can you create an issue focusing on the need to remove this because 3.9? Thanks!

Sure, issue about supporting python 3.9 created #20384.

@jsoriano jsoriano marked this pull request as ready for review August 6, 2020 12:04
@jsoriano jsoriano requested review from a team as code owners August 6, 2020 12:04
@jsoriano jsoriano added review :Testing enhancement and removed [zube]: In Progress in progress Pull request is currently in progress. labels Aug 6, 2020
@jsoriano jsoriano requested a review from a team August 6, 2020 12:26
@jsoriano jsoriano added needs_backport PR is waiting to be backported to other branches. v7.10.0 labels Aug 6, 2020
@botelastic botelastic bot added the Team:Automation Label for the Observability productivity team label Aug 6, 2020
@kuisathaverat
Copy link
Contributor

nice!! after merge this, we could add the retries we have in the APM ITs elastic/apm-integration-testing#866

@jsoriano jsoriano merged commit a6e2e24 into elastic:master Aug 6, 2020
@jsoriano jsoriano deleted the pytest branch August 6, 2020 15:11
jsoriano added a commit to jsoriano/beats that referenced this pull request Aug 6, 2020
Nosetests has been in maintenance mode for years, its last release was
released in 2015. Some functionality it uses from Python is going to be
removed in upcoming versions.

Use pytest to replace nosetests as testrunner. Features used from nose
libraries are replaced by features from the Python standard library and
from pytest.

(cherry picked from commit a6e2e24)
@jsoriano jsoriano removed the needs_backport PR is waiting to be backported to other branches. label Aug 6, 2020
jsoriano added a commit that referenced this pull request Aug 10, 2020
Packages listed in current requirements.txt file cannot be installed in
python 3.5 and 3.9:
* Pillow doesn't have a candidate for 3.9, it was already removed
  in #20407, but added again by mistake in #16883.
* zipp package needed by pytest works with different versions depending
  on the version of python, version that works with python 3.5 doesn't work
  with other versions.
jsoriano added a commit that referenced this pull request Aug 12, 2020
Nosetests has been in maintenance mode for years, its last release was
released in 2015. Some functionality it uses from Python is going to be
removed in upcoming versions.

Use pytest to replace nosetests as testrunner. Features used from nose
libraries are replaced by features from the Python standard library and
from pytest.

(cherry picked from commit a6e2e24)
melchiormoulin pushed a commit to melchiormoulin/beats that referenced this pull request Oct 14, 2020
Nosetests has been in maintenance mode for years, its last release was
released in 2015. Some functionality it uses from Python is going to be
removed in upcoming versions.

Use pytest to replace nosetests as testrunner. Features used from nose
libraries are replaced by features from the Python standard library and
from pytest.
melchiormoulin pushed a commit to melchiormoulin/beats that referenced this pull request Oct 14, 2020
Packages listed in current requirements.txt file cannot be installed in
python 3.5 and 3.9:
* Pillow doesn't have a candidate for 3.9, it was already removed
  in elastic#20407, but added again by mistake in elastic#16883.
* zipp package needed by pytest works with different versions depending
  on the version of python, version that works with python 3.5 doesn't work
  with other versions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement review Team:Automation Label for the Observability productivity team Team:Platforms Label for the Integrations - Platforms team :Testing v7.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants