From 3ac69507c3f87b77042e9639a7ccd00e85235290 Mon Sep 17 00:00:00 2001 From: wanghui5801 Date: Sun, 17 Nov 2024 07:49:34 +1100 Subject: [PATCH] add tests --- .github/workflows/tests.yml | 71 +++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..1e20760 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,71 @@ +name: Tests + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.8, 3.9, "3.10"] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + python -m pip install numpy pandas setuptools wheel + sudo apt-get update + sudo apt-get install -y g++ + + - name: Create package structure + run: | + mkdir -p utils + mkdir -p pattern_causality/utils + + cat > utils/__init__.py << 'EOL' + from .statespace import statespace + from .patternhashing import patternhashing + from .signaturespace import signaturespace + from .distancematrix import distancematrix + from .patternspace import patternspace + from .pastNNs import pastNNs + from .projectedNNs import projectedNNs + from .predictionY import predictionY + from .fillPCMatrix import fillPCMatrix + from .natureOfCausality import natureOfCausality + from .databank import databank + from .fcp import fcp + + __all__ = [ + 'statespace', 'patternhashing', 'signaturespace', 'distancematrix', + 'patternspace', 'pastNNs', 'projectedNNs', 'predictionY', + 'fillPCMatrix', 'natureOfCausality', 'databank', 'fcp' + ] + EOL + + touch pattern_causality/utils/__init__.py + + - name: Install package + run: | + pip install pytest pytest-cov + pip install -e . + + - name: List directory structure + run: | + echo "Current directory structure:" + find . -type f -name "*.py" -o -name "*.cpp" + + - name: Run tests + run: | + python -m pytest tests/ --cov=pattern_causality -v \ No newline at end of file