Skip to content

Commit

Permalink
[BUG] Fix python version compatibility issues affecting tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peytondmurray committed Nov 11, 2024
1 parent 92a199b commit 7a931d2
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_conda_store.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: "Set up Python 🐍"
uses: actions/setup-python@v5
with:
python-version-file: .python-version-default
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: "Install Dependencies 📦"
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/test_conda_store_server_integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
strategy:
matrix:
test-type: ["playwright", "integration", "user-journey"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
defaults:
run:
shell: bash -el {0}
Expand All @@ -38,18 +39,14 @@ jobs:
- name: "Checkout Repository 🛎"
uses: actions/checkout@v4

- name: "Get project's default Python version 🏷️"
run: |
echo "PYTHON_VERSION_DEFAULT=$(cat .python-version-default)" >> $GITHUB_ENV
- name: "Set up conda env 🐍"
uses: conda-incubator/setup-miniconda@v3
with:
environment-file: conda-store-server/environment-dev.yaml
miniforge-version: latest
auto-activate-base: false
activate-environment: conda-store-server-dev
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
python-version: ${{ matrix.python-version }}

- name: "Install dependencies 📦"
run: |
Expand Down Expand Up @@ -91,6 +88,14 @@ jobs:
python -m pytest -m "user_journey"
if: matrix.test-type == 'user-journey'

# These mirror the tests run while building the conda package
# See https://github.com/conda-forge/conda-store-feedstock/ for details
- name: "Run basic import tests ✅"
run: |
python -c "import conda_store_server"
conda-store-server --help
conda-store-worker --help
- name: "Get Docker logs 🔍"
if: ${{ failure() }}
run: |
Expand Down
4 changes: 2 additions & 2 deletions conda-store-server/conda_store_server/_internal/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import os
import re
import sys
from typing import Any, Callable, Dict, List, Optional, TypeAlias, Union
from typing import Any, Callable, Dict, List, Optional, Union

from conda_lock.lockfile.v1.models import Lockfile
from pydantic import BaseModel, Field, ValidationError, constr, validator
Expand Down Expand Up @@ -36,7 +36,7 @@ def _datetime_factory(offset: datetime.timedelta):
# Authentication Schema
#########################

RoleBindings: TypeAlias = Dict[constr(regex=ARN_ALLOWED), List[str]]
RoleBindings = Dict[constr(regex=ARN_ALLOWED), List[str]]


class Permissions(enum.Enum):
Expand Down
6 changes: 3 additions & 3 deletions conda-store-server/conda_store_server/_internal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import subprocess
import sys
import time
from typing import AnyStr
from typing import AnyStr, Tuple

from filelock import FileLock

Expand Down Expand Up @@ -156,7 +156,7 @@ def callable_or_value(v, *args, **kwargs):

def compile_arn_sql_like(
arn: str, allowed_regex: re.Pattern[AnyStr]
) -> tuple[str, str]:
) -> Tuple[str, str]:
"""Turn an arn into a string suitable for use in a SQL LIKE statement.
Parameters
Expand All @@ -172,7 +172,7 @@ def compile_arn_sql_like(
Returns
-------
tuple[str, str]
Tuple[str, str]
(namespace regex, environment regex) to match in a sql LIKE statement.
See conda_store_server.server.auth.Authentication.filter_environments
for usage.
Expand Down
6 changes: 3 additions & 3 deletions conda-store-server/conda_store_server/server/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import re
import secrets
from collections import defaultdict
from typing import Iterable, Optional, Set
from typing import Iterable, Optional, Set, Tuple

import jwt
import requests
Expand Down Expand Up @@ -228,7 +228,7 @@ def compile_arn_regex(arn: str) -> re.Pattern:
return re.compile(regex_arn)

@staticmethod
def compile_arn_sql_like(arn: str) -> tuple[str, str]:
def compile_arn_sql_like(arn: str) -> Tuple[str, str]:
"""Turn an arn into a string suitable for use in a SQL LIKE statement.
The use of this function is discouraged; use
Expand All @@ -247,7 +247,7 @@ def compile_arn_sql_like(arn: str) -> tuple[str, str]:
Returns
-------
tuple[str, str]
Tuple[str, str]
(namespace regex, environment regex) to match in a sql LIKE statement.
See conda_store_server.server.auth.Authentication.filter_environments
for usage.
Expand Down
4 changes: 2 additions & 2 deletions conda-store-server/environment-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ channels:
- conda-forge
- nodefaults
dependencies:
# must be kept in sync with .python-version-default
- python=3.12
# must be kept in sync with the min supported version in pyproject.toml
- python >=3.8
# conda builds
- conda
# dev dependencies
Expand Down
2 changes: 1 addition & 1 deletion conda-store-server/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ dependencies = [
"pymysql",
# pyyaml>5.3.1 is broken with cython>=3 transitive dependency
# See https://github.com/yaml/pyyaml/issues/724 for details
"pyyaml==5.3.1",
"pyyaml<=5.3.1",
"redis",
"requests",
"pydantic >=1.10.16,<2.0a0",
Expand Down

0 comments on commit 7a931d2

Please sign in to comment.