pre-commit: run black with string normalization

This commit is contained in:
Erik Sundell
2021-11-03 23:55:34 +01:00
parent 2ba942ba76
commit e0aaa4f995
31 changed files with 700 additions and 692 deletions

View File

@@ -8,18 +8,18 @@ import subprocess
import tempfile
@pytest.fixture(scope='module')
@pytest.fixture(scope="module")
def prefix():
"""
Provide a temporary directory with a mambaforge conda environment
"""
# see https://github.com/conda-forge/miniforge/releases
mambaforge_version = '4.10.3-7'
if os.uname().machine == 'aarch64':
mambaforge_version = "4.10.3-7"
if os.uname().machine == "aarch64":
installer_sha256 = (
"ac95f137b287b3408e4f67f07a284357b1119ee157373b788b34e770ef2392b2"
)
elif os.uname().machine == 'x86_64':
elif os.uname().machine == "x86_64":
installer_sha256 = (
"fc872522ec427fcab10167a93e802efaf251024b58cc27b084b915a9a73c4474"
)
@@ -31,7 +31,7 @@ def prefix():
installer_url, installer_sha256
) as installer_path:
conda.install_miniconda(installer_path, tmpdir)
conda.ensure_conda_packages(tmpdir, ['conda==4.10.3'])
conda.ensure_conda_packages(tmpdir, ["conda==4.10.3"])
yield tmpdir
@@ -39,29 +39,29 @@ def test_ensure_packages(prefix):
"""
Test installing packages in conda environment
"""
conda.ensure_conda_packages(prefix, ['numpy'])
conda.ensure_conda_packages(prefix, ["numpy"])
# Throws an error if this fails
subprocess.check_call([os.path.join(prefix, 'bin', 'python'), '-c', 'import numpy'])
subprocess.check_call([os.path.join(prefix, "bin", "python"), "-c", "import numpy"])
def test_ensure_pip_packages(prefix):
"""
Test installing pip packages in conda environment
"""
conda.ensure_conda_packages(prefix, ['pip'])
conda.ensure_pip_packages(prefix, ['numpy'])
conda.ensure_conda_packages(prefix, ["pip"])
conda.ensure_pip_packages(prefix, ["numpy"])
# Throws an error if this fails
subprocess.check_call([os.path.join(prefix, 'bin', 'python'), '-c', 'import numpy'])
subprocess.check_call([os.path.join(prefix, "bin", "python"), "-c", "import numpy"])
def test_ensure_pip_requirements(prefix):
"""
Test installing pip packages with requirements.txt in conda environment
"""
conda.ensure_conda_packages(prefix, ['pip'])
conda.ensure_conda_packages(prefix, ["pip"])
with tempfile.NamedTemporaryFile() as f:
# Sample small package to test
f.write(b'there')
f.write(b"there")
f.flush()
conda.ensure_pip_requirements(prefix, f.name)
subprocess.check_call([os.path.join(prefix, 'bin', 'python'), '-c', 'import there'])
subprocess.check_call([os.path.join(prefix, "bin", "python"), "-c", "import there"])