* Pin pre-commit Python version

* update pre-commit config

* Try fix Mamba tests Windows

* use boltons

* Fix channel in tests
This commit is contained in:
Antoine Prouvost 2023-10-03 22:20:29 +02:00 committed by GitHub
parent c8e593811c
commit 7c02338cb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 18 deletions

View File

@ -1,12 +1,12 @@
exclude: libmamba/tests/data/repodata_json_cache*
repos:
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.9.1
hooks:
- id: black
args: [--safe, --quiet]
- repo: https://github.com/asottile/blacken-docs
rev: 1.13.0
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: [black==22.3.0]
@ -32,17 +32,17 @@ repos:
- id: isort
exclude: tests/data
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
language_version: python3
additional_dependencies:
- flake8-typing-imports==1.14.0
- flake8-builtins==2.0.1
- flake8-bugbear==22.10.27
- flake8-isort==5.0.0
- flake8-typing-imports==1.15.0
- flake8-builtins==2.1.0
- flake8-bugbear==23.9.16
- flake8-isort==6.1.0
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.4
rev: v16.0.6
hooks:
- id: clang-format
args: [--style=file]

View File

@ -24,6 +24,7 @@ dependencies:
- pybind11-stubgen <1.0
- pytest >=7.3
- pyyaml
- boltons
- conda >=23.9.0
- conda-content-trust
- cryptography<40.0 # Or breaks conda-content-trust

View File

@ -10,7 +10,7 @@ import tempfile
import urllib.parse
from collections import OrderedDict
from conda._vendor.boltons.setutils import IndexedSet
from boltons.setutils import IndexedSet
from conda.base.constants import ChannelPriority
from conda.base.context import context
from conda.common.serialize import json_dump

View File

@ -6,9 +6,9 @@ import shutil
import string
import subprocess
import uuid
from distutils.version import StrictVersion
import pytest
from packaging.version import Version
from utils import (
Environment,
add_glibc_virtual_package,
@ -46,18 +46,18 @@ def test_update(shell_type):
# check updating a package when a newer version
with Environment(shell_type) as env:
# first install an older version
version = "1.25.11"
env.mamba(f"install -q -y urllib3={version}")
version = "2.0.0"
env.mamba(f"install -q -y --override-channels -c conda-forge urllib3={version}")
out = env.execute('python -c "import urllib3; print(urllib3.__version__)"')
# check that the installed version is the old one
assert out[-1] == version
# then update package
env.mamba("update -q -y urllib3")
env.mamba("update --override-channels -c conda-forge -q -y urllib3")
out = env.execute('python -c "import urllib3; print(urllib3.__version__)"')
# check that the installed version is newer
assert StrictVersion(out[-1]) > StrictVersion(version)
assert Version(out[-1]) > Version(version)
@pytest.mark.parametrize("shell_type", platform_shells())
@ -65,10 +65,12 @@ def test_env_update(shell_type, tmpdir):
# check updating a package when a newer version
with Environment(shell_type) as env:
# first install an older version
version = "1.25.11"
version = "2.0.0"
config_a = tmpdir / "a.yml"
config_a.write(
f"""
channels:
- conda-forge
dependencies:
- python
- urllib3={version}
@ -84,14 +86,16 @@ def test_env_update(shell_type, tmpdir):
config_b = tmpdir / "b.yml"
config_b.write(
"""
channels:
- conda-forge
dependencies:
- urllib3
"""
)
env.mamba(f"env update -q -f {config_b}")
env.mamba(f"env update -q -f {config_b}")
out = env.execute('python -c "import urllib3; print(urllib3.__version__)"')
# check that the installed version is newer
assert StrictVersion(out[-1]) > StrictVersion(version)
assert Version(out[-1]) > Version(version)
@pytest.mark.parametrize("shell_type", platform_shells())

View File

@ -886,7 +886,7 @@ def test_pre_commit_compat(tmp_home, tmp_root_prefix, tmp_path):
{"id": "sys-exec"},
{
"id": "additional-deps",
"additional_dependencies": ["psutil"],
"additional_dependencies": ["psutil", "python=3.11"],
},
],
}