Skip to content

Commit 2ab7fd5

Browse files
valeriupredoiKlaus Zimmermann
authored and
Klaus Zimmermann
committed
pin cf-units, remove github actions test for Python 3.6 and fix test_access1_0 and test_access1_3 to use cf-units for comparisons (#1197)
* fix test with cf units * fix test with cf units * test fully on GA * no need to import * pin cf units * pin cf units * pin cf units * retire python 36 * remove GA test branch
1 parent 65d05c5 commit 2ab7fd5

10 files changed

+20
-15
lines changed

.github/workflows/action-conda-publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
fail-fast: false
6060
matrix:
6161
os: ['ubuntu-latest', 'macos-latest']
62-
python-version: ["3.6", "3.7", "3.8", "3.9"]
62+
python-version: ["3.7", "3.8", "3.9"]
6363
runs-on: ${{ matrix.os }}
6464
needs: publish
6565
steps:

.github/workflows/action-install-from-conda.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
runs-on: "ubuntu-latest"
3535
strategy:
3636
matrix:
37-
python-version: [3.6, 3.7, 3.8, 3.9]
37+
python-version: [3.7, 3.8, 3.9]
3838
# fail-fast set to False allows all other tests
3939
# in the worflow to run regardless of any fail
4040
fail-fast: false
@@ -71,7 +71,7 @@ jobs:
7171
runs-on: "macos-latest"
7272
strategy:
7373
matrix:
74-
python-version: [3.6, 3.7, 3.8, 3.9]
74+
python-version: [3.7, 3.8, 3.9]
7575
fail-fast: false
7676
name: OSX Python ${{ matrix.python-version }}
7777
steps:

.github/workflows/action-install-from-pypi.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
runs-on: "ubuntu-latest"
3636
strategy:
3737
matrix:
38-
python-version: [3.6, 3.7, 3.8, 3.9]
38+
python-version: [3.7, 3.8, 3.9]
3939
# fail-fast set to False allows all other tests
4040
# in the worflow to run regardless of any fail
4141
fail-fast: false
@@ -72,7 +72,7 @@ jobs:
7272
runs-on: "macos-latest"
7373
strategy:
7474
matrix:
75-
python-version: [3.6, 3.7, 3.8, 3.9]
75+
python-version: [3.7, 3.8, 3.9]
7676
fail-fast: false
7777
name: OSX Python ${{ matrix.python-version }}
7878
steps:

.github/workflows/action-install-from-source.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
runs-on: "ubuntu-latest"
3737
strategy:
3838
matrix:
39-
python-version: [3.6, 3.7, 3.8, 3.9]
39+
python-version: [3.7, 3.8, 3.9]
4040
fail-fast: false
4141
name: Linux Python ${{ matrix.python-version }}
4242
steps:
@@ -71,7 +71,7 @@ jobs:
7171
runs-on: "macos-latest"
7272
strategy:
7373
matrix:
74-
python-version: [3.6, 3.7, 3.8, 3.9]
74+
python-version: [3.7, 3.8, 3.9]
7575
fail-fast: false
7676
name: OSX Python ${{ matrix.python-version }}
7777
steps:

.github/workflows/action-test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
runs-on: "ubuntu-latest"
3535
strategy:
3636
matrix:
37-
python-version: [3.6, 3.7, 3.8, 3.9]
37+
python-version: [3.7, 3.8, 3.9]
3838
fail-fast: false
3939
name: Linux Python ${{ matrix.python-version }}
4040
steps:
@@ -69,7 +69,7 @@ jobs:
6969
runs-on: "macos-latest"
7070
strategy:
7171
matrix:
72-
python-version: [3.6, 3.7, 3.8, 3.9]
72+
python-version: [3.7, 3.8, 3.9]
7373
fail-fast: false
7474
name: OSX Python ${{ matrix.python-version }}
7575
steps:

environment.yml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ channels:
55

66
dependencies:
77
- cftime # iris=3.0.1 needs <=1.2.1; >=1.3.0 - years<999 get a 0 instead of empty space
8+
- cf-units>=3.0.0
89
- compilers
910
- fiona # 1.8.18/py39, they seem weary to build manylinux wheels and pypi ver built with older gdal
1011
- esmpy

package/meta.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ requirements:
4242
- scipy<1.6 # until ESMValGroup/ESMValCore/issues/927 gets resolved
4343
# Normally installed via pip:
4444
- cftime # iris=3.0.1 needs <=1.2.1; >=1.3.0 years<999 get a 0 instead of empty space
45-
- cf-units>=2.1.5
45+
- cf-units>=3.0.0
4646
- cython # required by cf-units but not automatically installed
4747
- esmpy
4848
- fiona

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# Installation dependencies
3131
# Use with pip install . to install from source
3232
'install': [
33-
'cf-units>=2.1.5',
33+
'cf-units>=3.0.0',
3434
'dask[array]',
3535
'fiona',
3636
'fire',

tests/integration/cmor/_fixes/cmip5/test_access1_0.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ def test_fix_metadata(self):
4444
time = cube.coord('time')
4545
dates = num2date(time.points, time.units.name, time.units.calendar)
4646
self.assertEqual(time.units.calendar, 'gregorian')
47-
self.assertEqual(dates[0], datetime(300, 1, 16, 12, 0))
48-
self.assertEqual(dates[1], datetime(1850, 1, 16, 12, 0))
47+
u = Unit('days since 300-01-01 12:00:00', calendar='gregorian')
48+
self.assertEqual(dates[0], u.num2date(15))
49+
u = Unit('days since 1850-01-01 12:00:00', calendar='gregorian')
50+
self.assertEqual(dates[1], u.num2date(15))
4951

5052
def test_fix_metadata_if_not_time(self):
5153
"""Test calendar fix do not fail if no time coord present."""

tests/integration/cmor/_fixes/cmip5/test_access1_3.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ def test_fix_metadata(self):
4343
time = cube.coord('time')
4444
dates = num2date(time.points, time.units.name, time.units.calendar)
4545
self.assertEqual(time.units.calendar, 'gregorian')
46-
self.assertEqual(dates[0], datetime(300, 1, 16, 12, 0))
47-
self.assertEqual(dates[1], datetime(1850, 1, 16, 12, 0))
46+
u = Unit('days since 300-01-01 12:00:00', calendar='gregorian')
47+
self.assertEqual(dates[0], u.num2date(15))
48+
u = Unit('days since 1850-01-01 12:00:00', calendar='gregorian')
49+
self.assertEqual(dates[1], u.num2date(15))
4850

4951
def test_fix_metadata_if_not_time(self):
5052
"""Test calendar fix do not fail if no time coord present."""

0 commit comments

Comments
 (0)