Skip to content

Commit

Permalink
Merge pull request #39 from lucaskorol21/version-joss-rev
Browse files Browse the repository at this point in the history
Version joss rev -  non-GUI unit tests run through github actions
  • Loading branch information
jpcurbelo authored Sep 1, 2024
2 parents 63899ca + 9e861c5 commit 66205d9
Show file tree
Hide file tree
Showing 10 changed files with 282 additions and 384 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/go-rxr-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This workflow is designed to set up the necessary Python environment, install dependencies,
# and run the full suite of non-GUI unit tests for the GO-RXR project. It ensures that the code is
# consistently tested on Ubuntu 22.04 with Python 3.10.12. For further details, see:
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: GO-RXR Tests

on:
push:
branches: ["main", "version-joss-rev"]
pull_request:
branches: ["main", "version-joss-rev"]

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-22.04

steps:
- name: Check out the code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10.12'

- name: Install dependencies
run: |
pip install --upgrade pip setuptools
pip install -r requirements.txt
- name: Install PyQt5 Dependencies
run: |
sudo apt-get install -y pyqt5-dev libqt5multimedia5-plugins
- name: Install Reflectivity Package
run: |
python setup_reflectivity.py install
- name: Run tests
run: |
python -m unittest discover -s TESTS -p "test_data_fitting.py"
python -m unittest discover -s TESTS -p "test_data_structure.py"
python -m unittest discover -s TESTS -p "test_density.py"
python -m unittest discover -s TESTS -p "test_material_model.py"
python -m unittest discover -s TESTS -p "test_material_structure.py"
python -m unittest discover -s TESTS -p "test_reflectivity.py"
4 changes: 3 additions & 1 deletion GUI_GO.py
Original file line number Diff line number Diff line change
Expand Up @@ -10960,10 +10960,12 @@ def checkbracket(myStr):
return True
"""

def checkscript(sample, fname=''):
def checkscript(sample, fname='', testing=False):

if fname == '':
script = os.getcwd() + '/DATA/default_script.txt'
elif testing:
script = fname
else:
script = os.getcwd() + fname
#script = fname
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,3 +313,8 @@ The GO-RXR software package has been utilized for analyzing the RXR data in the
If issues feel free to contact me at [email protected].
# Test workflow trigger
5 changes: 4 additions & 1 deletion TESTS/run_all_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# Add the parent directory to the system path
sys.path.append(parent_dir)

from UTILS import ROOT_DIR

def load_tests_from_file(test_file):
# Load the test suite from the given file
loader = unittest.TestLoader()
Expand All @@ -30,5 +32,6 @@ def discover_and_run_tests(test_dir):
print(f"Total tests run: {tot_test}")

if __name__ == "__main__":
test_dir = "."

test_dir = ROOT_DIR + '/TESTS'
discover_and_run_tests(test_dir)
Loading

0 comments on commit 66205d9

Please sign in to comment.