-
Notifications
You must be signed in to change notification settings - Fork 1
Initial unit tests for task_functions #73
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
Draft
StaceyD22
wants to merge
6
commits into
dev
Choose a base branch
from
initial-unit-test-setup
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f463fa7
Initial unit tests for task_functions
StaceyD22 a4aa6f1
Add unit test workflow to run on push for github pipeline
StaceyD22 761f791
Fix typing support to include 3.9
StaceyD22 384eef4
Add coverage reporting
StaceyD22 a830f6b
Update permission set for GitHub actions
StaceyD22 62d1d0d
Add test for exception, pull more constants out of files
StaceyD22 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: Run Unit Test via Pytest | ||
|
|
||
| on: [push] | ||
|
|
||
| jobs: | ||
| build: | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.9", "3.10", "3.11"] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
| - name: Test with pytest | ||
| run: | | ||
| coverage run -m pytest tests | ||
| continue-on-error: true | ||
| - name: Generate Coverage Report | ||
| run: | | ||
| coverage report -m | ||
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| # Test file names | ||
| EXAMPLE_POS_FILENAME = "1a_MZmine3_pos.csv" | ||
| EXAMPLE_NEG_FILENAME = "1b_MZmine3_neg.csv" | ||
| EXAMPLE_TRACER_FILENAME = "WW2DW_Tracers_Amenable.csv" | ||
| EXAMPLE_RUN_SEQUENCE_POS_FILENAME = "WW2DW_sequence_cal.csv" | ||
| EXAMPLE_RUN_SEQUENCE_NEG_FILENAME = "WW2DW_sequence_cal.csv" | ||
| EXAMPLE_SURROGATE_FILENAME = "qNTA_Surrogate_Input_File_WW2DW.csv" | ||
|
|
||
| # Define pos/neg/neutral adduct lists | ||
| # Proton added - we observe Mass-(H+) and Mass+(Adduct) | ||
| NEG_ADDUCT_LI = [ | ||
| ("Cl", 35.976678), | ||
| ("Br", 79.926161), | ||
| ("HCO2", 46.005477), | ||
| ("CH3CO2", 60.021127), | ||
| ("CF3CO2", 113.992862), | ||
| ] | ||
|
|
||
| # Proton subtracted - we observe Mass+(H+) and Mass+(Adduct) | ||
| POS_ADDUCT_LI = [ | ||
| ("Na", 21.981942), | ||
| ("K", 37.955882), | ||
| ("NH4", 17.026547), | ||
| ] | ||
|
|
||
| NEUTRAL_LOSSES_LI = [ | ||
| ("H2O", -18.010565), | ||
| ("2H2O", -36.02113), | ||
| ("3H2O", -54.031695), | ||
| ("4H2O", -72.04226), | ||
| ("5H2O", -90.052825), | ||
| ("NH3", -17.0265), | ||
| ("O", -15.99490), | ||
| ("CO", -29.00220), | ||
| ("CO2", -43.989829), | ||
| ("C2H4", -28.03130), | ||
| ("CH2O2", 46.00550), # note here and below - not losses? but still neutral? | ||
| ("CH3COOH", 60.02110), | ||
| ("CH3OH", 32.02620), | ||
| ("CH3CN", 41.02650), | ||
| ("(CH3)2CHOH", 60.05810), | ||
| ] | ||
|
|
||
| # Set to tested memory capacity of WebApp for number of features in 'adduct_matrix' | ||
| MAX_NUM_ADDUCT_FEATURES = 12000 | ||
|
|
||
| # Column names accessed throughout app | ||
| FEATURE_ID_COL = "Feature ID" | ||
| DASHBOARD_SEARCH_COL = "For_Dashboard_Search" | ||
| FORMULA_COL = "Formula" | ||
| MASS_COL = "Mass" | ||
| RETENTION_COL = "Retention_Time" | ||
| IONIZATION_COL = "Ionization_Mode" | ||
| MOLECULAR_FORMULA_COL = "MOLECULAR_FORMULA" | ||
|
|
||
| # Format lists to test values agains | ||
| ALLOWED_BLANK_FORMATS_LIST = ["Blank", "blank", "BLANK", "MB", "Mb", "mb", "mB"] | ||
| ACTIVE_COLUMNS_LIST = [ | ||
| "Retention_Time", | ||
| "Mass", | ||
| "Ionization_Mode", | ||
| "Compound", | ||
| ] | ||
|
|
||
| # Establish ordering of all possible front matter (tracer/no tracer, flags/no flags, etc.) | ||
| FRONT_MATTER_ORDERING = [ | ||
| "Ionization_Mode", | ||
| "Mass", | ||
| "Retention_Time", | ||
| "Compound", | ||
| "Tracer Chemical Match?", | ||
| "Duplicate Feature?", | ||
| "Is Adduct or Loss?", | ||
| "Has Adduct or Loss?", | ||
| "Adduct or Loss Info", | ||
| "Final Occurrence Count", | ||
| "Final Occurrence Percentage", | ||
| "Final Occurrence Count (with flags)", | ||
| "Final Occurrence Percentage (with flags)", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.