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

Refactor class StepwisePlugin. #4335

Closed
wants to merge 1 commit into from

Conversation

henrykironde
Copy link
Contributor

@henrykironde henrykironde commented Nov 7, 2018

Initialize class properties
Check attributes before accessing them, LBYL

checklist

  • Create a new changelog file in the changelog folder, with a name like <ISSUE NUMBER>.<TYPE>.rst. See changelog/README.rst for details.
  • Target the master branch for bug fixes, documentation updates and trivial changes.
  • Target the features branch for new features and removals/deprecations.
  • Include documentation when adding new features.
  • Include new tests or update existing tests when applicable.
  • Add yourself to AUTHORS in alphabetical order;

ref: #4333

Copy link
Contributor

@blueyed blueyed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have not really checked, but see #4304 (changelog file should be improved/renamed).

Does this fix it completely? A test would be good to have!

@@ -0,0 +1 @@
pytest version 3.10.1 Fails on python2.7
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3.10.1 is not there yet.. ;)
Also this should be more specific about the fix.

@codecov
Copy link

codecov bot commented Nov 8, 2018

Codecov Report

Merging #4335 into master will decrease coverage by <.01%.
The diff coverage is 80%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4335      +/-   ##
==========================================
- Coverage   95.84%   95.84%   -0.01%     
==========================================
  Files         111      111              
  Lines       24880    24884       +4     
  Branches     2430     2432       +2     
==========================================
+ Hits        23847    23849       +2     
  Misses        736      736              
- Partials      297      299       +2
Flag Coverage Δ
#docs 28.92% <30%> (ø) ⬆️
#doctesting 28.92% <30%> (ø) ⬆️
#linting 28.92% <30%> (ø) ⬆️
#linux 95.62% <80%> (-0.01%) ⬇️
#nobyte 91.83% <80%> (-0.01%) ⬇️
#numpy 93.01% <80%> (-0.01%) ⬇️
#pexpect 41.68% <30%> (ø) ⬆️
#py27 94.01% <80%> (-0.01%) ⬇️
#py34 92.14% <80%> (+0.05%) ⬆️
#py35 92.15% <80%> (+0.05%) ⬆️
#py36 93.9% <80%> (ø) ⬆️
#py37 92.19% <80%> (+0.05%) ⬆️
#trial 93.01% <80%> (-0.01%) ⬇️
#windows 93.95% <80%> (-0.01%) ⬇️
#xdist 93.72% <80%> (ø) ⬆️
Impacted Files Coverage Δ
src/_pytest/stepwise.py 92.85% <80%> (-3.3%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 64762d2...d4d1bf4. Read the comment docs.

Initialize class properties.
Check attributes before accessing them, LBYL.
@henrykironde
Copy link
Contributor Author

@blueyed, this seems to fix the issue. I would love to make a test case but I don't seem to get the organization of the tests.
However the logic to create testing for the pytest_sessionfinish function would be:

  • Start a session.

  • Initialize StepwisePlugin class object and add the session.

If the test are to pass, testing that is covered
The main goal is to have the tests fail, and parse a "--stepwise".

  • If active self.active = config.getvalue("stepwise") is set,
    we should have some values in self.lastfailed
    from self.config.cache.set("cache/stepwise", self.lastfailed)
    else expected values will be []
    from self.config.cache.set("cache/stepwise", [])

@nicoddemus
Copy link
Member

Thanks @henrykironde for the contribution.

As @blueyed mentioned before, this is a duplicate of #4304.

In pytest many contributed tests use the testdir fixture to create small test cases which demonstrate an issue, run pytest, and check the output. There are tons of examples in testing, browse around and I'm sure you will get the gist of it.

Closing this now as this issue in particular was already fixed by #4304, but we look forward for your future contributions. 👍

@nicoddemus nicoddemus closed this Nov 8, 2018
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

Successfully merging this pull request may close these issues.

3 participants