diff --git a/.github/flake8.yml b/.github/archive/flake8.yml similarity index 100% rename from .github/flake8.yml rename to .github/archive/flake8.yml diff --git a/.github/publish-anaconda.yml b/.github/archive/publish-anaconda.yml similarity index 100% rename from .github/publish-anaconda.yml rename to .github/archive/publish-anaconda.yml diff --git a/.github/unit-tests-epics-base.yml b/.github/archive/unit-tests-epics-base.yml similarity index 100% rename from .github/unit-tests-epics-base.yml rename to .github/archive/unit-tests-epics-base.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/unit_tests.yml similarity index 61% rename from .github/workflows/tests.yml rename to .github/workflows/unit_tests.yml index 0782c4e91..a5719d585 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/unit_tests.yml @@ -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: | @@ -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 @@ -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: | @@ -97,10 +142,17 @@ 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} @@ -108,6 +160,10 @@ jobs: 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: | diff --git a/CHANGES.rst b/CHANGES.rst index 1466ab0a9..2b09f05dc 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -17,11 +17,20 @@ Change History The project `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 ****** diff --git a/apstools/__init__.py b/apstools/__init__.py index b3c92e1f1..8d6e42621 100644 --- a/apstools/__init__.py +++ b/apstools/__init__.py @@ -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__ diff --git a/apstools/callbacks/tests/test_filewriter.py b/apstools/callbacks/tests/test_filewriter.py index 5a07728fe..a7f07df45 100644 --- a/apstools/callbacks/tests/test_filewriter.py +++ b/apstools/callbacks/tests/test_filewriter.py @@ -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") diff --git a/environment.yml b/environment.yml index f79c3c128..74d42142b 100644 --- a/environment.yml +++ b/environment.yml @@ -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 diff --git a/requirements.txt b/requirements.txt index 4baec9acf..87c27fa13 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,7 @@ bluesky>=1.6.2 databroker==1 databroker-pack h5py +mongoquery>=1.3.6 numpy ophyd>=1.5.1 openpyxl