Skip to content

Conversation

@germa89
Copy link
Collaborator

@germa89 germa89 commented May 19, 2025

Description

To catch warnings

Issue linked

NA

Checklist

Summary by Sourcery

Enforce strict pytest markers and update test marking conventions throughout the suite

CI:

  • Enable strict marker enforcement in pytest configuration

Tests:

  • Rename the 'gui' marker to 'requires_gui' and add a new 'console' marker
  • Replace deprecated pytest.mark.fail with pytest.mark.xfail in test_launcher
  • Switch @pytest.mark.trylast to @pytest.hookimpl(trylast=True) in the pytest_configure hook

@germa89 germa89 self-assigned this May 19, 2025
@germa89 germa89 requested a review from a team as a code owner May 19, 2025 15:55
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented May 19, 2025

Reviewer's Guide

Enforce strict pytest marker usage by updating configuration, standardizing marker names, migrating a deprecated hook decorator, and correcting an expected-failure marker in tests.

File-Level Changes

Change Details Files
Enforce strict markers in pytest configuration
  • Added '--strict-markers' flag to pytest addopts
  • Renamed 'gui' marker to 'requires_gui'
  • Added new 'console' marker
pyproject.toml
Migrate deprecated pytest decorator to hook implementation
  • Replaced @pytest.mark.trylast with @pytest.hookimpl(trylast=True)
tests/conftest.py
Correct expected-failure marker in test
  • Changed pytest.mark.fail to pytest.mark.xfail in test_launcher
tests/test_launcher.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@ansys-reviewer-bot
Copy link
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

@germa89 germa89 changed the title Using strict markers on pytest ci: using strict markers on pytest May 19, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @germa89 - I've reviewed your changes - here's some feedback:

  • Under --strict-markers, you’ll need to declare xfail (and any other custom markers you’re using) in the markers list, otherwise pytest will error on unknown markers.
  • The new console marker name may be ambiguous—consider renaming it to something like requires_console for consistency with requires_gui.
  • Switching to @pytest.hookimpl(trylast=True) relies on a newer pytest API—double-check your minimum pytest version in CI to avoid compatibility issues.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Testing: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@github-actions github-actions bot added dependencies maintenance General maintenance of the repo (libraries, cicd, etc) CI/CD Related with CICD, Github Actions, etc labels May 20, 2025
@github-actions github-actions bot added CI/CD Related with CICD, Github Actions, etc and removed CI/CD Related with CICD, Github Actions, etc labels May 20, 2025
…e pytest arguments to enforce strict markers in workflows
@codecov
Copy link

codecov bot commented May 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.27%. Comparing base (55914e8) to head (e47d352).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3934      +/-   ##
==========================================
- Coverage   88.29%   88.27%   -0.03%     
==========================================
  Files         187      187              
  Lines       14830    14830              
==========================================
- Hits        13094    13091       -3     
- Misses       1736     1739       +3     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@germa89 germa89 enabled auto-merge (squash) May 20, 2025 14:51
@germa89
Copy link
Collaborator Author

germa89 commented May 20, 2025

@pyansys-ci-bot LGTM

Copy link
Contributor

@pyansys-ci-bot pyansys-ci-bot left a comment

Choose a reason for hiding this comment

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

✅ Approving this PR because germa89 said so in here 😬

LGTM

@germa89 germa89 merged commit e680cd3 into main May 20, 2025
88 of 89 checks passed
@germa89 germa89 deleted the refactor/pytest-warnings branch May 20, 2025 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD Related with CICD, Github Actions, etc dependencies maintenance General maintenance of the repo (libraries, cicd, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants