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

Tests for the sensors panel #696

Merged
merged 5 commits into from
Nov 11, 2024
Merged

Tests for the sensors panel #696

merged 5 commits into from
Nov 11, 2024

Conversation

dc2917
Copy link
Contributor

@dc2917 dc2917 commented Nov 7, 2024

Description

This PR adds units tests for the functionality of the sensors panel on the GUI.

Fixes #106

Type of change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Documentation (non-breaking change that adds or improves the documentation)
  • Optimisation (non-breaking, back-end change that speeds up the code)

Key checklist

  • Pre-commit hooks run successfully (pre-commit run -a)
  • All tests pass (pytest)
  • The documentation builds without warnings (mkdocs build -s)
  • Check the GUI still works (if relevant)
  • Check the code works with actual hardware (if relevant)
  • Check the pyinstaller-built executable works (if relevant)

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests have been added or an issue has been opened to tackle that in the future. (Indicate issue here: # (issue))

@dc2917 dc2917 requested review from dalonsoa and alexdewar November 7, 2024 17:49
@alexdewar
Copy link
Collaborator

Hmm... mypy seems to be complaining. I removed the pytest-mypy extension, so you'll have to run it manually over your code to find the source of the error.

Copy link

codecov bot commented Nov 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.30%. Comparing base (1444cb4) to head (b89c318).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #696      +/-   ##
==========================================
+ Coverage   85.31%   86.30%   +0.98%     
==========================================
  Files          69       69              
  Lines        3549     3549              
==========================================
+ Hits         3028     3063      +35     
+ Misses        521      486      -35     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dc2917
Copy link
Contributor Author

dc2917 commented Nov 8, 2024

Hmm... mypy seems to be complaining. I removed the pytest-mypy extension, so you'll have to run it manually over your code to find the source of the error.

Yeah, had this on the mirror angle PR as well, for the exact same thing. It's related to the QWidget inheritance - it seems I need to do something like assert isinstance(widget_to_investigate, ConcreteWidget), and then can query attributes of the concrete widget type.

In terms of running mypy, I have it running as a pre-commit hook but perhaps it's ignoring the tests/ directory. Pretty sure I ran pre-commit run --all-files before pushing 🤷.

Copy link
Collaborator

@alexdewar alexdewar left a comment

Choose a reason for hiding this comment

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

Looking good. Thanks for sorting this!

There's one line I think you can drop. but it's not esp important.

tests/gui/test_sensors_panel.py Show resolved Hide resolved
tests/gui/test_sensors_panel.py Outdated Show resolved Hide resolved
@dc2917 dc2917 merged commit 23f81ad into main Nov 11, 2024
7 checks passed
@dc2917 dc2917 deleted the test_sensorspanel branch November 11, 2024 09:18
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.

Add tests for SensorsPanel
2 participants