From a2728092c265462b3f35a22122ceae79714e74d3 Mon Sep 17 00:00:00 2001 From: gfrn Date: Thu, 28 Jul 2022 15:36:49 -0300 Subject: [PATCH] Sets up automated unit tests --- .bandit | 2 +- .github/workflows/test.yml | 25 +++++++++++++++++++++++++ pyproject.toml | 3 ++- tests/unit/test_validation.py | 2 -- 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.bandit b/.bandit index ddc4ceb..6e4e7d2 100644 --- a/.bandit +++ b/.bandit @@ -1,2 +1,2 @@ [bandit] -exclude: /test +exclude: /tests diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..dde5701 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,25 @@ +name: Lint + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.9] + 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 dependencies + run: | + python -m pip install --upgrade pip + python -m pip install .[dev] + + - name: Unit tests + run: python -m pytest tests/unit/ \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 652daca..0715ad1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,5 +50,6 @@ dev = [ "mypy==0.812", "mypy-extensions==0.4.3", "pyflakes==2.3.1", - "types-setuptools" + "types-setuptools", + "pytest==7.1.2" ] \ No newline at end of file diff --git a/tests/unit/test_validation.py b/tests/unit/test_validation.py index f84668b..3f34eb0 100644 --- a/tests/unit/test_validation.py +++ b/tests/unit/test_validation.py @@ -1,6 +1,4 @@ import unittest -from unittest.mock import MagicMock, patch -from pydrs import EthDRS from pydrs.validation import ( SerialErrCheckSum, SerialErrPckgLen,