diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ba6e6a5..941368c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,7 +2,7 @@ name: main on: push: - branches: [main] + branches: [master] pull_request: jobs: @@ -22,3 +22,32 @@ jobs: - name: Lint with flake8 run: flake8 --count + tests: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + + - name: Install pacakge + run: | + sudo apt-get install -y ffmpeg + python -m pip install --upgrade pip + pip install -e . + + - name: Test with pytest + run: | + pip install -r requirements-test.txt + pytest --cov=frequenpy --cov-report=term-missing + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index 80d2a8c..d46f43c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # FrequenPy +![coverage_badge](https://codecov.io/gh/tomaslink/frequenpy/branch/master/graph/badge.svg) + _FrequenPy_ is a high-precision physics engine dedicated to the study of standing waves and visualization of its normal modes. This package has educational purposes. diff --git a/frequenpy/loaded_string/animation.py b/frequenpy/loaded_string/animation.py index 1061764..fa75085 100644 --- a/frequenpy/loaded_string/animation.py +++ b/frequenpy/loaded_string/animation.py @@ -1,6 +1,7 @@ import logging from os import path, makedirs +import matplotlib from matplotlib import pyplot as plt from matplotlib import animation @@ -8,6 +9,7 @@ logger = logging.getLogger(__name__) + LINE_WIDTH = 1 LINE_MARKERTYPE = 'o' LINE_MARKERSIZE = 8 @@ -120,7 +122,8 @@ def _build_figure(self): ax.add_line(self._right_support(support_distance_from_origin)) ax.add_line(self._line) - plt.get_current_fig_manager().window.resizable(False, False) + if matplotlib.get_backend() == 'TkAgg': + plt.get_current_fig_manager().window.resizable(False, False) return fig diff --git a/requirements-test.txt b/requirements-test.txt new file mode 100644 index 0000000..be2e3e7 --- /dev/null +++ b/requirements-test.txt @@ -0,0 +1 @@ +pytest-cov<5 diff --git a/requirements.txt b/requirements.txt index 7023c43..a219cd1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ flake8<7 -pytest-cov<5 +-r requirements-test.txt -e . diff --git a/setup.py b/setup.py index 9420506..ed9d146 100644 --- a/setup.py +++ b/setup.py @@ -25,6 +25,7 @@ }, install_requires=[ 'numpy<2', - 'matplotlib<4' + 'matplotlib<4', + 'ffmpeg-python' ] ) diff --git a/tests/loaded_string/test_animation.py b/tests/loaded_string/test_animation.py index a4b601c..de24654 100644 --- a/tests/loaded_string/test_animation.py +++ b/tests/loaded_string/test_animation.py @@ -1,5 +1,4 @@ import os - from matplotlib import pyplot from frequenpy.loaded_string.animation import LoadedStringAnimation