Skip to content

Commit

Permalink
Test with conda on python 3.10 (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
dionhaefner authored Feb 21, 2022
1 parent 58c3d9a commit 16d6077
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 16 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: pre-commit

on:
pull_request:

push:
branches:
- main

jobs:
pre-commit:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]
16 changes: 6 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ jobs:
fail-fast: false

matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest]
# only test oldest and most recent supported Python versions
# no rasterio wheels on 3.10 yet, so we use 3.9 for now
python-version: ["3.6", "3.9"]

defaults:
Expand Down Expand Up @@ -60,7 +61,6 @@ jobs:
pip install cython numpy
- name: Setup MySQL
if: contains(matrix.os, 'ubuntu')
run: |
sudo /etc/init.d/mysql start
mysql -e 'SHOW DATABASES;' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }}
Expand All @@ -77,12 +77,8 @@ jobs:
- name: Run tests
run: |
if [ ${{ runner.os }} == "Linux" ]; then
MYSQL_SRV="${{ env.DB_USER }}:${{ env.DB_PASSWORD }}@127.0.0.1:${{ env.DB_PORT }}"
python -m pytest . --color=yes --cov=terracotta --mysql-server=$MYSQL_SRV
else
python -m pytest . --color=yes --cov=terracotta
fi
MYSQL_SRV="${{ env.DB_USER }}:${{ env.DB_PASSWORD }}@127.0.0.1:${{ env.DB_PORT }}"
python -m pytest . --color=yes --cov=terracotta --mysql-server=$MYSQL_SRV
- name: Run benchmarks
run: |
Expand All @@ -101,9 +97,9 @@ jobs:
fail-fast: false

matrix:
os: [windows-latest]
os: [macos-latest, windows-latest]
# Python 3.6 is EOL on conda-forge, so use 3.7 instead
python-version: ["3.7", "3.9"]
python-version: ["3.7", "3.10"]

defaults:
run:
Expand Down
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
repos:
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
hooks:
- id: flake8
args: ['--config=setup.cfg']

exclude: "
^$\
|terracotta/_version.py\
|docs\
"
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ max-line-length = 100
[tool:pytest]
addopts =
--mypy
--flake8
--benchmark-group-by=func
--benchmark-columns=min,max,median
-v
Expand All @@ -26,8 +25,6 @@ filterwarnings =
ignore:numpy.ufunc size changed:RuntimeWarning
# sometimes, dependencies leak resources
ignore:.*socket\.socket.*:pytest.PytestUnraisableExceptionWarning
flake8-ignore =
terracotta/_version.py ALL

[mypy]
show_error_codes = True
Expand Down
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,11 @@
'pytest',
'pytest-cov',
'pytest-mypy',
'pytest-flake8',
'pytest-benchmark',
'attrs>=17.4.0',
'codecov',
'colorlog',
'crick',
'flake8',
'matplotlib',
'moto',
'aws-xray-sdk',
Expand Down
2 changes: 1 addition & 1 deletion terracotta/handlers/singleband.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def singleband(keys: Union[Sequence[str], Mapping[str, str]],
else:
stretch_min, stretch_max = stretch_range

preserve_values = isinstance(colormap, collections.Mapping)
preserve_values = isinstance(colormap, collections.abc.Mapping)

settings = get_settings()
if tile_size is None:
Expand Down

0 comments on commit 16d6077

Please sign in to comment.