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

Require pytest for test runners #1167

Merged
merged 5 commits into from
Jan 16, 2022
Merged

Conversation

ischoegl
Copy link
Member

@ischoegl ischoegl commented Jan 14, 2022

Changes proposed in this pull request

  • Always use pytest for Python test suite
  • This ensures that pytest features can be used in unit tests

If applicable, fill in the issue number this pull request is fixing

Addresses Cantera/enhancements#128

Checklist

  • The pull request includes a clear description of this code change
  • Commit messages have short titles and reference relevant issues
  • Build passes (scons build & scons test) and unit tests address code coverage
  • Style & formatting of contributed code follows contributing guidelines
  • The pull request is ready for review

@ischoegl ischoegl marked this pull request as ready for review January 14, 2022 21:42
@ischoegl ischoegl requested a review from a team January 14, 2022 21:59
@ischoegl
Copy link
Member Author

@speth and @bryanwweber … this should be it (last thing I added was a meaningful error with instructions if pytest isn’t found). I guess it would be possible to also issue a message earlier when dependencies are checked, but pytest isn’t really needed outside the test suite. Let me know …

Copy link
Member

@speth speth left a comment

Choose a reason for hiding this comment

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

Looks good to me. I'll leave this open for the moment to see if @bryanwweber has any thoughts.

Copy link
Member

@bryanwweber bryanwweber left a comment

Choose a reason for hiding this comment

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

LGTM thanks @ischoegl!

cantera_root = os.path.relpath(__file__).split(os.sep)[:-1] + ['..', '..']
os.chdir(os.sep.join(cantera_root + ['test', 'work']))
CANTERA_ROOT = Path(__file__).parents[2]
os.chdir(str(CANTERA_ROOT / "test" / "work"))
Copy link
Member

Choose a reason for hiding this comment

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

I'm not a big fan of chdir, I find that it leads to confusion about where files will be placed. Hopefully we can just get rid of this file entirely someday, since we don't need all the stuff that we had for compatibility with unittest that are in this file.

@bryanwweber bryanwweber merged commit c47efef into Cantera:main Jan 16, 2022
@ischoegl ischoegl deleted the require-pytest branch January 16, 2022 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants