Skip to content

Commit

Permalink
44 create and automate test suite (#46)
Browse files Browse the repository at this point in the history
* Basic test and workflow.

* Workflow installing pytest.

* Wrong command.

* Running linting first.

* Proper unit test.

* Fix test dependency.

* Removed non-working spectrogram code.

* Fixing version mechanism

---------
  • Loading branch information
gvanhoy authored Mar 23, 2023
1 parent c8e809c commit 36d0f61
Show file tree
Hide file tree
Showing 63 changed files with 1,603 additions and 10,687 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Test

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements.txt') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip --upgrade-strategy eager
pip install -r requirements.txt
- name: Build package
run: |
python -m pip install .
- name: Lint with flake8
run: |
pip3 install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pip install pytest
pytest
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ timm==0.5.4
segmentation_models_pytorch
pytorch_lightning
sympy
numba
torchmetrics
15 changes: 6 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import os
import setuptools
from distutils.core import setup
import setuptools

with open("README.md") as f:
long_description = f.read()

exec(open('torchsig/version.py').read())

setup(
name='torchsig',
version=__version__,
description='Signal Processing Machine Learning Toolkit',
name="torchsig",
version="0.1.0",
description="Signal Processing Machine Learning Toolkit",
long_description=long_description,
long_description_content_type="text/markdown",
author='TorchSig Team',
url='https://github.com/torchdsp/torchsig',
author="TorchSig Team",
url="https://github.com/torchdsp/torchsig",
packages=setuptools.find_packages(),
)
8 changes: 8 additions & 0 deletions tests/test_datasets_sig53.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from torchsig.datasets.sig53 import Sig53
from unittest import TestCase


class GenerateSig53(TestCase):
def test_can_generate_sig53_clean_train(self):
x = 2 + 2
self.assertEqual(x, 4)
3 changes: 2 additions & 1 deletion torchsig/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
from torchsig import datasets
from torchsig import utils
from torchsig import models
from .version import __version__

__version__ = "0.1.0"
2 changes: 0 additions & 2 deletions torchsig/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
from . import iq_models
from . import spectrogram_models
from torchsig.models.iq_models import *
from torchsig.models.spectrogram_models import *
8 changes: 0 additions & 8 deletions torchsig/models/spectrogram_models/__init__.py

This file was deleted.

201 changes: 0 additions & 201 deletions torchsig/models/spectrogram_models/detr/LICENSE.md

This file was deleted.

5 changes: 0 additions & 5 deletions torchsig/models/spectrogram_models/detr/README.md

This file was deleted.

1 change: 0 additions & 1 deletion torchsig/models/spectrogram_models/detr/__init__.py

This file was deleted.

Loading

0 comments on commit 36d0f61

Please sign in to comment.