diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml new file mode 100644 index 00000000..b351615e --- /dev/null +++ b/.github/workflows/unit_tests.yml @@ -0,0 +1,57 @@ +name: Python package + +on: + push: + branches: ['**'] + pull_request: + branches: ['**'] + create: + branches: [main] + tags: ['**'] + schedule: + - cron: "0 4 * * *" + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8] + + 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 stuff for PyQt + run: | + sudo -E apt-get install --no-install-recommends -y \ + openmpi-bin lsof \ + libfontconfig1 libxext6 libx11-xcb1 libxcb-glx0 \ + libxkbcommon-x11-0 libgl1-mesa-glx \ + libncurses5 libreadline5 libdbus-1-3 libopenmpi-dev \ + libc6-dev libtinfo-dev libncurses5-dev \ + libx11-dev libreadline-dev \ + libxcb-icccm4 libxcb-util1 libxcb-image0 libxcb-keysyms1 \ + libxcb-render0 libxcb-shape0 libxcb-randr0 libxcb-render-util0 \ + libxcb-xinerama0 libxcb-xfixes0 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest pytest-qt pytest-cov mne + pip install hnn_core + + - name: Install HNN + run: | + python setup.py install + + - name: Lint with flake8 + run: | + flake8 --count hnn + - name: Test with pytest + run: | + python -m py.test . --cov=hnn hnn/tests/ --cov-report=xml diff --git a/hnn/qt_psd.py b/hnn/qt_psd.py index d27f7fb2..83622e98 100644 --- a/hnn/qt_psd.py +++ b/hnn/qt_psd.py @@ -1,4 +1,5 @@ import os +import sys from math import sqrt from copy import deepcopy diff --git a/hnn/qt_sim.py b/hnn/qt_sim.py index 8de4a660..38a32621 100644 --- a/hnn/qt_sim.py +++ b/hnn/qt_sim.py @@ -396,7 +396,6 @@ def plotsimdat(self): xlim = (first_spec_trial['time'][0], first_spec_trial['time'][-1]) - # set the axes of input histograms to match dipole and spec plots for ax in hist_axes: ax.set_xlim(xlim) diff --git a/setup.py b/setup.py index 59d909c2..6651bcc7 100644 --- a/setup.py +++ b/setup.py @@ -37,5 +37,7 @@ packages=find_packages(), package_data={'hnn': ['../param/*.param']}, - install_requires=['hnn-core'] + install_requires=['nlopt', + 'psutil', + 'pyqt5'] )