Skip to content

Commit

Permalink
General: Re-introduced github actions; tests: Fixed file path calcula…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
Somerandomguy10111 committed Apr 26, 2024
1 parent d357d54 commit a4d69f1
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 8 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Run Unittests

on: [push]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10' # Adjust to your project's Python version
- name: Install dependencies
run: |
sudo apt install build-essential # GNU C++ compiler
sudo apt install libboost-all-dev # C++ libraries provided by Boost
sudo apt install swig # python -> C++ bridge
python -m pip install --upgrade pip
pip install tox
- name: Run tox tests
run: |
TOX_FILE=$(find . -name tox.ini)
echo "-> Located tox file at $TOX_FILE"
if [ -f "setup.py" ]; then
echo "-> Found setup.py, using tox.ini with pkg environment"
tox -c $TOX_FILE -e pkg $RECREATE_FLAG
else
echo "-> No setup.py found, using tox.ini with requirements environment"
tox -c $TOX_FILE -e req $RECREATE_FLAG
fi
13 changes: 6 additions & 7 deletions tests/base_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,29 @@ def check_data_ok(self, data : XrdIntensities):
self.assertIsInstance(key, float)
self.assertIsInstance(value, float)


@classmethod
def get_stoe_fpath(cls) -> str:
return cls.get_example_dirpath() + 'stoe.raw'
return os.path.join(cls.get_example_dirpath(), 'stoe.raw')

@classmethod
def get_bruker_fpath(cls) -> str:
return cls.get_example_dirpath() + 'bruker.raw'
return os.path.join(cls.get_example_dirpath(), 'bruker.raw')

@classmethod
def get_single_csv_fpath(cls) -> str:
return cls.get_example_dirpath() + 'single.csv'
return os.path.join(cls.get_example_dirpath(), 'single.csv')

@classmethod
def get_multi_csv_fpath(cls) -> str:
return cls.get_example_dirpath() + 'multi.csv'
return os.path.join(cls.get_example_dirpath(), 'multi.csv')

@classmethod
def get_aimat_json_fpath(cls) -> str:
return cls.get_example_dirpath() + 'aimat.json'
return os.path.join(cls.get_example_dirpath(), 'aimat.json')

@classmethod
def get_datafolder_fpath(cls) -> str:
return cls.get_example_dirpath() + 'datafolder'
return os.path.join(cls.get_example_dirpath(), 'datafolder')

@staticmethod
def get_example_dirpath() -> str:
Expand Down
2 changes: 1 addition & 1 deletion tests/t_xrdpattern_cls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os.path
from xrdpattern.pattern import XrdPattern
from tests.base_testss import PatternBaseTest
from tests.base_tests import PatternBaseTest

import tempfile

Expand Down

0 comments on commit a4d69f1

Please sign in to comment.