Skip to content

Commit

Permalink
Merge pull request #685 from BCDA-APS/673-drop-py3.7
Browse files Browse the repository at this point in the history
change Python versions in test matrix
  • Loading branch information
prjemian authored Jul 31, 2022
2 parents ee7cf97 + b537b7d commit 7da0c8d
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 26 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
70 changes: 63 additions & 7 deletions .github/workflows/tests.yml → .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,63 @@ jobs:
run: |
flake8
install-catalogs:
name: Install & cache databroker catalogs
runs-on: ubuntu-latest
needs: lint

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install git+https://github.com/bluesky/databroker-pack.git@master
- name: Unpack
run: |
cd resources
bash ./unpack.sh
cd ..
- name: Directory Listings
run: |
ls -lAFghR ~/.local/
ls -lAFghR /tmp/*_test/
- name: Prepare archival content
run: |
mkdir -p ~/databroker_catalogs/
mv ~/.local ~/databroker_catalogs/
mv /tmp/*_test ~/databroker_catalogs/
- name: Archive catalog artifacts
uses: actions/upload-artifact@v3
with:
name: databroker_catalogs
path: ~/databroker_catalogs

test-matrix:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
needs: lint
needs: install-catalogs
strategy:
matrix:
# python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.7', '3.8', '3.9']
python-version: ['3.8', '3.9', '3.10']
max-parallel: 5

steps:
- uses: actions/checkout@v2

- name: Create Python ${{ matrix.python-version }} environment
uses: mamba-org/provision-with-micromamba@v12
uses: mamba-org/provision-with-micromamba@main
# use main branch to enable choice of channel-priority
with:
cache-env: true
cache-env-key: env-key-${{ matrix.python-version }}
channel-priority: flexible
environment-file: environment.yml
environment-name: anaconda-test-env-py-${{ matrix.python-version }}
extra-specs: |
Expand All @@ -68,6 +107,9 @@ jobs:
micromamba env list
printenv | sort
- name: Directories before Docker
run: ls -lAFghrt ~/

- name: Start EPICS IOCs in Docker
run: |
bash ./.github/scripts/start_xxx.sh gp
Expand All @@ -76,6 +118,9 @@ jobs:
ls -lAFgh /tmp/docker_ioc/iocad/
ls -lAFgh /tmp/docker_ioc/iocgp/
- name: Directories after Docker
run: ls -lAFghrt ~/

- name: Confirm EPICS IOC is available via caget
shell: bash -l {0}
run: |
Expand All @@ -97,17 +142,28 @@ jobs:
CMD+="; print(up.get())"
python -c "${CMD}"
- name: install test data catalogs
shell: bash -l {0}
- name: Download catalog artifacts
uses: actions/download-artifact@v3
with:
name: databroker_catalogs
path: ~/databroker_catalogs

- name: Restore archival content
run: |
./resources/unpack.sh
mkdir -p ~/.local/share/intake
mv ~/databroker_catalogs/.local/share/intake/* ~/.local/share/intake
mv ~/databroker_catalogs/*_test /tmp/
- name: Diagnostics
shell: bash -l {0}
run: |
df -HT
micromamba list
- name: Test catalog length, expect 53
shell: bash -l {0}
run: python -c "import databroker; print(len(databroker.catalog['apstools_test']))"

- name: Run tests with pytest & coverage
shell: bash -l {0}
run: |
Expand Down
17 changes: 13 additions & 4 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,20 @@ Change History
The project `milestones <https://github.com/BCDA-APS/apstools/milestones>`_
describe the future plans.

..
1.6.3
******
1.6.3
******

release expected by 2022-08-31

Maintenance
---------------

* Unit tests now Python version 3.8, 3.9, & 3.10.

Deprecations
---------------

release expected by 2022-08-31
* Drop support for Python 3.7.

1.6.2
******
Expand Down
2 changes: 1 addition & 1 deletion apstools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
__platforms__ = "any"
__zip_safe__ = False
__exclude_project_dirs__ = "docs resources".split()
__python_version_required__ = ">=3.7, <3.10"
__python_version_required__ = ">=3.8, <3.11"

__package_name__ = __project__
__long_description__ = __description__
Expand Down
22 changes: 10 additions & 12 deletions apstools/callbacks/tests/test_filewriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,27 +164,25 @@ def test_NXWriter_make_file_name(tempdir):
assert callback.uid is None

with pytest.raises(TypeError) as exinfo:
# error from f"-S{self.scan_id:05d}"
callback.make_file_name()
assert (
"an integer is required (got type NoneType)"
in str(exinfo.value)
)
callback.start_time = 1000 # 1969-12-31T18:16:40
assert exinfo is not None
assert "NoneType" in str(exinfo.value), f"{callback=} {exinfo=}"
assert "an integer" in str(exinfo.value), f"{callback=} {exinfo=}"

callback.start_time = 1000 # 1969-12-31T18:16:40
with pytest.raises(TypeError) as exinfo:
# error from datetime.datetime.fromtimestamp
callback.make_file_name()
assert (
"unsupported format string passed to NoneType.__format__"
==
str(exinfo.value)
)
callback.scan_id = 9876
expected = "unsupported format string passed to NoneType.__format__"
assert expected == str(exinfo.value)

callback.scan_id = 9876
with pytest.raises(TypeError) as exinfo:
callback.make_file_name()
assert "'NoneType' object is not subscriptable" == str(exinfo.value)
callback.uid = "012345678901234567890123456789"

callback.uid = "012345678901234567890123456789"
fname = callback.make_file_name()
# https://github.com/BCDA-APS/apstools/issues/345
tz_aps = dateutil.tz.gettz("America/Chicago")
Expand Down
7 changes: 5 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
name: apstoolsdoc
name: apstools-test-environment

channels:
- conda-forge
- defaults
# nsls2forge channel for newer mongoquery 1.3.6 (issue #673)
- nsls2forge

dependencies:
- python >=3.7, <3.10
- python >=3.8, <3.11
- area-detector-handlers
- bluesky >=1.6.7
- databroker =1.2
- databroker-pack
- h5py
- intake
- mongoquery >=1.3.6
- openpyxl
- ophyd >=1.6.1
- pandas
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ bluesky>=1.6.2
databroker==1
databroker-pack
h5py
mongoquery>=1.3.6
numpy
ophyd>=1.5.1
openpyxl
Expand Down

0 comments on commit 7da0c8d

Please sign in to comment.