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

Automate testing of em-public-dashboard plots #173

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

iantei
Copy link
Contributor

@iantei iantei commented Oct 29, 2024

  • Initial setup of Github Action
    • Introduce test_with_docker.yml file
    • Calls when we have git push or pull request in main branch
    • Calls up docker-compose.tests.yml which will subsequently call start_tests.sh, that will trigger pytest for test_plots.py
  • Initial unit test cases for plots.py using pytest and coverage
    • Since pytest will be directly run through python file, rather than notebook. Updated plots.py to allow this.
    • Execute unit test using pytest for initial function of calculate_pct() and merge_small_entries()

Current coverage progress:

notebook-server-1  | ======================== 6 passed, 12 warnings in 1.94s ========================
notebook-server-1  | Name                                    Stmts   Miss  Cover
notebook-server-1  | -----------------------------------------------------------
notebook-server-1  | /usr/src/app/saved-notebooks/plots.py     303    248    18%
notebook-server-1  | test_plots.py                              48      0   100%
notebook-server-1  | -----------------------------------------------------------
notebook-server-1  | TOTAL                                     351    248    29%

@iantei iantei marked this pull request as ready for review October 29, 2024 22:53
…since emission is two directory above the current test_*.py files directory. Used importlib as the parent directory has - in saved-notebooks.
@iantei iantei changed the title Automate dashboard plots Automate testing of em-public-dashboard plots Nov 6, 2024
Copy link
Contributor

@JGreenlee JGreenlee left a comment

Choose a reason for hiding this comment

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

LGTM, great start for coverage!

Testing the notebooks themselves will be a separate challenge but I think this PR is a strong first step because it introduces pytest and a GH workflow

Is there an issue / PR somewhere to discuss further automated testing? I think pytest-notebook looks promising, or even just having assert statements embedded in the notebooks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready for review by Shankari
Development

Successfully merging this pull request may close these issues.

2 participants