Skip to content

Commit

Permalink
Merge pull request #2 from FAIRmat-NFDI/fix-tests
Browse files Browse the repository at this point in the history
Updats ci and fixes momentum tests
  • Loading branch information
rettigl authored Aug 19, 2024
2 parents 6e967fc + a237bb0 commit 2a4d281
Show file tree
Hide file tree
Showing 7 changed files with 206 additions and 406 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/black.yml

This file was deleted.

95 changes: 0 additions & 95 deletions .github/workflows/publish.yml

This file was deleted.

83 changes: 22 additions & 61 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,76 +1,37 @@
name: Run Tests
name: pytest

on:
push:
branches:
- master
- main
branches: [master]
pull_request:
branches: "**"
branches: [master]

jobs:
test:
pytest:
runs-on: ubuntu-latest

env:
QT_QPA_PLATFORM: offscreen
strategy:
max-parallel: 5
fail-fast: false
matrix:
python_version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
- uses: actions/checkout@v3
with:
python-version: "3.8"

- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Get conda package dir
id: conda-cache
run: |
echo "::set-output name=dir::$(conda info --json | python -c "import sys, json; print(json.load(sys.stdin)['pkgs_dirs'][0])")"
- name: Cache conda and PyPI modules
uses: actions/cache@v2
env:
cache-name: cache-conda-and-pypi
fetch-depth: 0
submodules: recursive
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v4
with:
path: |
${{ steps.pip-cache.outputs.dir }}
${{ steps.conda-cache.outputs.dir }}
key: ${{ runner.os }}-build-${{ env.cache-name}}-${{ hashFiles('**/environment*.yml') }}
restore-keys: |
${{ runner.os }}-conda
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
conda env create --quiet --file environment.yml
- name: Source environment, test with pytest and generate coverage
python -m pip install --upgrade pip
- name: Install package
run: |
source activate arpes
conda env update --file environment-update-test.yml
sudo apt install libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0
echo "Installed dependencies as below"
pip freeze
echo "Now running tests"
python -m pytest -c pytest-config/pytest-coverage-codecov.ini
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
fail_ci_if_error: true
path_to_write_report: ./coverage/codecov_report.txt
verbose: true
pip install -e ".[core, test]"
pip install pytest pytest-qt
- name: Test with pytest
run: |
pytest -sv --show-capture=no tests
15 changes: 8 additions & 7 deletions arpes/utilities/qt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
"""Infrastructure code for Qt based analysis tools."""
from arpes.typing import xr_types
import pyqtgraph as pg
from pyqtgraph import ViewBox
import functools
from multiprocessing import Process
from typing import Callable

import dill
import pyqtgraph as pg
from pyqtgraph import ViewBox

from typing import Callable
from arpes.typing import xr_types

from .app import SimpleApp
from .data_array_image_view import DataArrayImageView
from .help_dialogs import BasicHelpDialog
from .windows import SimpleWindow
from .app import SimpleApp

__all__ = (
"DataArrayImageView",
Expand Down Expand Up @@ -123,9 +124,9 @@ def inches_to_px(self, arg):
arg,
(int, float),
):
return self.screen_dpi * arg
return int(self.screen_dpi * arg)

return map(lambda x: x * self.screen_dpi, arg)
return map(lambda x: int(x * self.screen_dpi), arg)

def setup_pyqtgraph(self):
"""Does any patching required on PyQtGraph and configures options."""
Expand Down
24 changes: 13 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
from setuptools.command.install import install

NAME = "arpes"
DESCRIPTION = "Modular data analysis code for angle resolved photoemission spectroscopy (ARPES)"
DESCRIPTION = (
"Modular data analysis code for angle resolved photoemission spectroscopy (ARPES)"
)
URL = "https://gitlab.com/lanzara-group/python-arpes"
EMAIL = "[email protected]"
AUTHOR = "Conrad Stansbury"
REQUIRES_PYTHON = ">=3.8.0,<3.9" # we're being less permissive because of pyqtgraph
REQUIRES_PYTHON = ">=3.8.0,<3.12" # we're being less permissive because of pyqtgraph

about = {}
with open("./arpes/__init__.py") as fp:
Expand All @@ -28,7 +30,7 @@
"h5py>=3.2.1",
"pyqtgraph>=0.12.0,<0.13.0",
"PyQt5==5.15",
"netCDF4>=1.5.0,<2.0.0",
"netCDF4>=1.5.0,<1.7.0",
"colorcet",
"pint",
"pandas",
Expand Down Expand Up @@ -60,7 +62,9 @@
],
}

requirements = [y for k, v in DEPENDENCY_GROUPS.items() for y in v if k not in {"igor", "ml"}]
requirements = [
y for k, v in DEPENDENCY_GROUPS.items() for y in v if k not in {"igor", "ml"}
]

DEV_DEPENDENCIES = {
"jupyter": [
Expand Down Expand Up @@ -91,19 +95,17 @@
You should follow standard best practices for working with IPython and Jupyter.
To get the interactive volumetric data explorer `qt_tool` you will need to install
`PyQt5` and `pyqtgraph`.
`PyQt5` and `pyqtgraph`.
To use the Igor data loading libraries in PyARPES you will need to install the `igor`
To use the Igor data loading libraries in PyARPES you will need to install the `igor`
module from 'https://github.com/chstan/igorpy/tarball/712a4c4#egg=igor-0.3.1'.
Some functionality, including PCA/Factor Analysis decomposition tools, require
additional heavy dependencies such as `scikit-learn` and `scikit-image`.
Some functionality, including PCA/Factor Analysis decomposition tools, require
additional heavy dependencies such as `scikit-learn` and `scikit-image`.
For Jupyter integration, please have a look at the documentation (link above).
For support issues, contact [email protected] or [email protected].
""".format(
DOCUMENTATION_URL
)
""".format(DOCUMENTATION_URL)

packages = find_packages(
exclude=(
Expand Down
Loading

0 comments on commit 2a4d281

Please sign in to comment.