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

Pytest, testing expansion for neutrals and plots #80

Merged
merged 35 commits into from
Jul 23, 2019
Merged

Pytest, testing expansion for neutrals and plots #80

merged 35 commits into from
Jul 23, 2019

Conversation

jklenzing
Copy link
Member

@jklenzing jklenzing commented Jul 11, 2019

Description

  • Switching from nose to pytest for future unit tests.
    • Adds blank init.py to tests as required by pytest-cov.
    • Switches @raises() to with pytest.raises():
  • Other testing expansion
    • Removes python 3.4 from Travis CI testing.
    • Updates handling of plot tests for travis.
    • test_core_class now runs for both the formatted and unformatted test sets.
    • Neutral test data regenerated and tested throughout.
  • Fixes bugs in the loading of neutral data into xarray
  • Model.plot_lat_alt() now returns figure handle instead of just plotting.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Tested via Travis CI and locally.

Checklist:

  • Make sure you are merging into the develop (not master) branch
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@jklenzing jklenzing added the testing unit tests for code label Jul 11, 2019
@jklenzing jklenzing added this to the 0.2.0 Release milestone Jul 16, 2019
@jklenzing jklenzing changed the title Use Pytest Pytest, testing expansion for neutrals and plots Jul 16, 2019
assert abs(xlims[0] + 36.3329) < tol
assert abs(xlims[1] - 19.37387) < tol
assert abs(ylims[0] - 84.98926) < tol
assert abs(ylims[1] - 1999.998) < tol
Copy link
Member Author

Choose a reason for hiding this comment

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

Since this test is now run twice and the two data sets are slightly different, updates to use a tolerance rather than exact precision.

return float_data[1:-1, :]
return float_data[1:-1]
else:
Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure you need the else here. If reshape is True then the second return will be short-circuited by the return inside the if. But this works just as well. Not sure if there's a benefit one way or the other. Perhaps this is more readable.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking of readability

@jklenzing jklenzing merged commit 02e6136 into develop Jul 23, 2019
@jklenzing jklenzing deleted the pytest branch July 23, 2019 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing unit tests for code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants