From a927dc67513d59c86c17e79556dfa5cec022f0ad Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sat, 25 Feb 2023 21:26:36 +0100 Subject: [PATCH 1/5] Initial durations --- .test_durations | 120 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 .test_durations diff --git a/.test_durations b/.test_durations new file mode 100644 index 00000000..0db659db --- /dev/null +++ b/.test_durations @@ -0,0 +1,120 @@ +{ + "conda_lock/models/test_channel.py::test__detect_used_env_var": 0.0044590262696146965, + "conda_lock/models/test_channel.py::test_url_auth_info": 0.01338486629538238, + "tests/test_conda_lock.py::test__add_auth_to_line[# pip mypackage @ https://pypi.mychannel.cloud/simple-auth4-# pip mypackage @ https://username1:password1@pypi.mychannel.cloud/simple]": 0.0027642359491437674, + "tests/test_conda_lock.py::test__add_auth_to_line[# pip mypackage @ https://pypi.otherchannel.cloud/simple-auth5-# pip mypackage @ https://pypi.otherchannel.cloud/simple]": 0.0021687184926122427, + "tests/test_conda_lock.py::test__add_auth_to_line[https://conda.mychannel.cloud/channel1/mypackage-auth2-https://username:password@conda.mychannel.cloud/channel1/mypackage]": 0.0022148219868540764, + "tests/test_conda_lock.py::test__add_auth_to_line[https://conda.mychannel.cloud/channel1/mypackage-auth3-https://username1:password1@conda.mychannel.cloud/channel1/mypackage]": 0.0020119459368288517, + "tests/test_conda_lock.py::test__add_auth_to_line[https://conda.mychannel.cloud/mypackage-auth0-https://username:password@conda.mychannel.cloud/mypackage]": 0.0020599619019776583, + "tests/test_conda_lock.py::test__add_auth_to_line[https://conda.mychannel.cloud/mypackage-auth1-https://conda.mychannel.cloud/mypackage]": 0.0018740820232778788, + "tests/test_conda_lock.py::test__add_auth_to_lockfile[# The following domains require authentication:\\n# - a.mychannel.cloud\\n# - c.mychannel.cloud\\n# - d.mychannel.cloud\\nhttp://a.mychannel.cloud/mypackage\\nhttp://b.mychannel.cloud/mypackage\\nhttp://c.mychannel.cloud/mypackage\\n# pip mypackage @ http://d.mychannel.cloud/mypackage\\n-# The following domains require authentication:\\n# - a.mychannel.cloud\\n# - c.mychannel.cloud\\n# - d.mychannel.cloud\\nhttp://username_a:password_a@a.mychannel.cloud/mypackage\\nhttp://b.mychannel.cloud/mypackage\\nhttp://username_c:password_c@c.mychannel.cloud/mypackage\\n# pip mypackage @ http://username_d:password_d@d.mychannel.cloud/mypackage\\n]": 0.0021428640466183424, + "tests/test_conda_lock.py::test__extract_domain[# pip mypackage @ https://pypi.mychannel.cloud/simple-pypi.mychannel.cloud]": 0.004476058064028621, + "tests/test_conda_lock.py::test__extract_domain[http://conda.mychannel.cloud/mypackage-conda.mychannel.cloud]": 0.00953778624534607, + "tests/test_conda_lock.py::test__extract_domain[https://conda.mychannel.cloud/mypackage-conda.mychannel.cloud]": 0.01166083524003625, + "tests/test_conda_lock.py::test__strip_auth_from_line[# pip mypackage @ https://pypi.mychannel.cloud/simple-# pip mypackage @ https://pypi.mychannel.cloud/simple]": 0.004538550041615963, + "tests/test_conda_lock.py::test__strip_auth_from_line[# pip mypackage @ https://username1:password1@pypi.mychannel.cloud/simple-# pip mypackage @ https://pypi.mychannel.cloud/simple]": 0.004323852248489857, + "tests/test_conda_lock.py::test__strip_auth_from_line[http://conda.mychannel.cloud/mypackage-http://conda.mychannel.cloud/mypackage]": 0.0055056612472981215, + "tests/test_conda_lock.py::test__strip_auth_from_line[http://user:password@conda.mychannel.cloud/mypackage-http://conda.mychannel.cloud/mypackage]": 0.005796841811388731, + "tests/test_conda_lock.py::test__strip_auth_from_line[https://conda.mychannel.cloud/mypackage-https://conda.mychannel.cloud/mypackage]": 0.015453723957762122, + "tests/test_conda_lock.py::test__strip_auth_from_line[https://user:password@conda.mychannel.cloud/mypackage-https://conda.mychannel.cloud/mypackage]": 0.013227654155343771, + "tests/test_conda_lock.py::test__strip_auth_from_lockfile[http://a.mychannel.cloud/mypackage\\nhttp://b.mychannel.cloud/mypackage\\nhttp://c.mychannel.cloud/mypackage\\n# pip mypackage @ http://d.mychannel.cloud/mypackage\\n-http://a.mychannel.cloud/mypackage\\nhttp://b.mychannel.cloud/mypackage\\nhttp://c.mychannel.cloud/mypackage\\n# pip mypackage @ http://d.mychannel.cloud/mypackage\\n]": 0.0017164601013064384, + "tests/test_conda_lock.py::test__strip_auth_from_lockfile[http://user:password@a.mychannel.cloud/mypackage\\nhttp://b.mychannel.cloud/mypackage\\nhttp://user:password@c.mychannel.cloud/mypackage\\n# pip mypackage @ http://user:password@d.mychannel.cloud/mypackage\\n-# The following domains require authentication:\\n# - a.mychannel.cloud\\n# - c.mychannel.cloud\\n# - d.mychannel.cloud\\nhttp://a.mychannel.cloud/mypackage\\nhttp://b.mychannel.cloud/mypackage\\nhttp://c.mychannel.cloud/mypackage\\n# pip mypackage @ http://d.mychannel.cloud/mypackage\\n]": 0.0019474257715046406, + "tests/test_conda_lock.py::test_aggregate_lock_specs": 1.2763855010271072, + "tests/test_conda_lock.py::test_aggregate_lock_specs_invalid_channels": 0.03590670810081065, + "tests/test_conda_lock.py::test_aggregate_lock_specs_multiple_platforms": 0.006713381968438625, + "tests/test_conda_lock.py::test_aggregate_lock_specs_override_version": 1.6720386389642954, + "tests/test_conda_lock.py::test_choose_wheel": 7.891909349011257, + "tests/test_conda_lock.py::test_cli_version": 1.0643445942550898, + "tests/test_conda_lock.py::test_default_virtual_package_input_hash_stability": 0.005248077679425478, + "tests/test_conda_lock.py::test_extract_json_object": 0.0016865991055965424, + "tests/test_conda_lock.py::test_fake_conda_env[conda]": 2.4932802789844573, + "tests/test_conda_lock.py::test_fake_conda_env[mamba]": 3.1682756498921663, + "tests/test_conda_lock.py::test_fake_conda_env[micromamba]": 1.2988834620919079, + "tests/test_conda_lock.py::test_install[conda-env]": 140.27129216119647, + "tests/test_conda_lock.py::test_install[conda-explicit]": 19.50872055394575, + "tests/test_conda_lock.py::test_install[mamba-env]": 19.579558146651834, + "tests/test_conda_lock.py::test_install[mamba-explicit]": 9.53389447904192, + "tests/test_conda_lock.py::test_install[micromamba-env]": 6.250606240937486, + "tests/test_conda_lock.py::test_install[micromamba-explicit]": 9.245201598852873, + "tests/test_conda_lock.py::test_lock_poetry_ibis": 42.33643715083599, + "tests/test_conda_lock.py::test_parse_env_file_with_filters_defaults": 0.017547639086842537, + "tests/test_conda_lock.py::test_parse_env_file_with_filters_no_args": 0.013967463746666908, + "tests/test_conda_lock.py::test_parse_environment_file": 0.017137509072199464, + "tests/test_conda_lock.py::test_parse_environment_file_with_pip": 0.014858064008876681, + "tests/test_conda_lock.py::test_parse_flit": 0.006220192881301045, + "tests/test_conda_lock.py::test_parse_meta_yaml_file": 0.06765178288333118, + "tests/test_conda_lock.py::test_parse_pdm": 7.360471409978345, + "tests/test_conda_lock.py::test_parse_pip_requirement[package-thingie1[foo]-parsed0]": 0.002158720977604389, + "tests/test_conda_lock.py::test_parse_pip_requirement[package[extra] = 2.1-parsed2]": 0.0019457850139588118, + "tests/test_conda_lock.py::test_parse_pip_requirement[package[extra] == 2.1-parsed3]": 0.0023466390557587147, + "tests/test_conda_lock.py::test_parse_pip_requirement[package[extra] >=0.8.0-alpha.2,<1.0.0.0-parsed6]": 0.005290928995236754, + "tests/test_conda_lock.py::test_parse_pip_requirement[package[extra] >=2.1.*, <4.0-parsed5]": 0.0069599400740116835, + "tests/test_conda_lock.py::test_parse_pip_requirement[package[extra] @ https://foo.bar/package.whl#sha1=blerp-parsed1]": 0.0019281471613794565, + "tests/test_conda_lock.py::test_parse_pip_requirement[package[extra]===2.1-parsed4]": 0.0021447089966386557, + "tests/test_conda_lock.py::test_parse_poetry": 6.9989939029328525, + "tests/test_conda_lock.py::test_parse_poetry_no_pypi": 0.0075933379121124744, + "tests/test_conda_lock.py::test_poetry_version_parsing_constraints[python->=3.6,<3.7-/python-3.6]": 8.781420079059899, + "tests/test_conda_lock.py::test_poetry_version_parsing_constraints[python-^2.7-/python-2.7]": 32.686923403060064, + "tests/test_conda_lock.py::test_poetry_version_parsing_constraints[python-~3.6-/python-3.6]": 7.1190555829089135, + "tests/test_conda_lock.py::test_prepare_repositories_pool": 0.01316592376679182, + "tests/test_conda_lock.py::test_private_lock[conda-$QUETZ_API_KEY]": 167.53543734387495, + "tests/test_conda_lock.py::test_private_lock[conda-${QUETZ_API_KEY}]": 14.05618537706323, + "tests/test_conda_lock.py::test_private_lock[mamba-$QUETZ_API_KEY]": 29.20311124715954, + "tests/test_conda_lock.py::test_private_lock[mamba-${QUETZ_API_KEY}]": 10.083066730760038, + "tests/test_conda_lock.py::test_private_lock[micromamba-$QUETZ_API_KEY]": 7.757304751081392, + "tests/test_conda_lock.py::test_private_lock[micromamba-${QUETZ_API_KEY}]": 0.04886101931333542, + "tests/test_conda_lock.py::test_run_lock[conda]": 83.847992134979, + "tests/test_conda_lock.py::test_run_lock[mamba]": 43.905100357951596, + "tests/test_conda_lock.py::test_run_lock[micromamba]": 44.00821655779146, + "tests/test_conda_lock.py::test_run_lock_blas_mkl[conda]": 27.50570274796337, + "tests/test_conda_lock.py::test_run_lock_blas_mkl[mamba]": 7.7282587920781225, + "tests/test_conda_lock.py::test_run_lock_blas_mkl[micromamba]": 6.085412611020729, + "tests/test_conda_lock.py::test_run_lock_regression_gh155[conda]": 12.19158754707314, + "tests/test_conda_lock.py::test_run_lock_regression_gh155[mamba]": 9.053441614843905, + "tests/test_conda_lock.py::test_run_lock_regression_gh155[micromamba]": 4.326663556043059, + "tests/test_conda_lock.py::test_run_lock_relative_source_path[conda]": 2.4107686991337687, + "tests/test_conda_lock.py::test_run_lock_relative_source_path[mamba]": 2.4218363990075886, + "tests/test_conda_lock.py::test_run_lock_relative_source_path[micromamba]": 2.246905382955447, + "tests/test_conda_lock.py::test_run_lock_uppercase_pip[conda]": 12.315469726920128, + "tests/test_conda_lock.py::test_run_lock_uppercase_pip[mamba]": 7.507358531001955, + "tests/test_conda_lock.py::test_run_lock_uppercase_pip[micromamba]": 3.7060587687883526, + "tests/test_conda_lock.py::test_run_lock_with_custom_metadata[conda]": 16.25292714405805, + "tests/test_conda_lock.py::test_run_lock_with_custom_metadata[mamba]": 76.81640638317913, + "tests/test_conda_lock.py::test_run_lock_with_custom_metadata[micromamba]": 3.5591639990452677, + "tests/test_conda_lock.py::test_run_lock_with_git_metadata[conda]": 16.833537717116997, + "tests/test_conda_lock.py::test_run_lock_with_git_metadata[mamba]": 7.034437482943758, + "tests/test_conda_lock.py::test_run_lock_with_git_metadata[micromamba]": 3.538599671330303, + "tests/test_conda_lock.py::test_run_lock_with_input_hash_check[conda]": 34.062637554015964, + "tests/test_conda_lock.py::test_run_lock_with_input_hash_check[mamba]": 2.547731716185808, + "tests/test_conda_lock.py::test_run_lock_with_input_hash_check[micromamba]": 2.074163547018543, + "tests/test_conda_lock.py::test_run_lock_with_input_metadata[conda]": 19.766404184978455, + "tests/test_conda_lock.py::test_run_lock_with_input_metadata[mamba]": 6.900205792160705, + "tests/test_conda_lock.py::test_run_lock_with_input_metadata[micromamba]": 51.49917463120073, + "tests/test_conda_lock.py::test_run_lock_with_local_package[conda]": 0.011794581077992916, + "tests/test_conda_lock.py::test_run_lock_with_local_package[mamba]": 0.02334260498173535, + "tests/test_conda_lock.py::test_run_lock_with_local_package[micromamba]": 0.012574640102684498, + "tests/test_conda_lock.py::test_run_lock_with_locked_environment_files[conda]": 2.585544525878504, + "tests/test_conda_lock.py::test_run_lock_with_locked_environment_files[mamba]": 2.785396486055106, + "tests/test_conda_lock.py::test_run_lock_with_locked_environment_files[micromamba]": 15.509860154706985, + "tests/test_conda_lock.py::test_run_lock_with_pip[conda]": 352.00825743796304, + "tests/test_conda_lock.py::test_run_lock_with_pip[mamba]": 7.3949902430176735, + "tests/test_conda_lock.py::test_run_lock_with_pip[micromamba]": 21.479689084924757, + "tests/test_conda_lock.py::test_run_lock_with_pip_environment_different_names_same_deps[conda]": 14.562333019217476, + "tests/test_conda_lock.py::test_run_lock_with_pip_environment_different_names_same_deps[mamba]": 15.594794017029926, + "tests/test_conda_lock.py::test_run_lock_with_pip_environment_different_names_same_deps[micromamba]": 54.5677305161953, + "tests/test_conda_lock.py::test_run_lock_with_time_metadata[conda]": 16.39776355284266, + "tests/test_conda_lock.py::test_run_lock_with_time_metadata[mamba]": 5.529624433722347, + "tests/test_conda_lock.py::test_run_lock_with_time_metadata[micromamba]": 2.918327509891242, + "tests/test_conda_lock.py::test_run_lock_with_update[conda]": 155.17123162886128, + "tests/test_conda_lock.py::test_run_lock_with_update[mamba]": 9.115055882139131, + "tests/test_conda_lock.py::test_run_lock_with_update[micromamba]": 43.55620776605792, + "tests/test_conda_lock.py::test_run_with_channel_inversion": 114.43516132631339, + "tests/test_conda_lock.py::test_spec_poetry": 0.00874163187108934, + "tests/test_conda_lock.py::test_virtual_package_input_hash_stability": 0.004808719968423247, + "tests/test_conda_lock.py::test_virtual_packages[conda-env]": 40.06911605782807, + "tests/test_conda_lock.py::test_virtual_packages[conda-explicit]": 166.67617870983668, + "tests/test_conda_lock.py::test_virtual_packages[mamba-env]": 9.238974520936608, + "tests/test_conda_lock.py::test_virtual_packages[mamba-explicit]": 3.896394713083282, + "tests/test_conda_lock.py::test_virtual_packages[micromamba-env]": 8.28422360913828, + "tests/test_conda_lock.py::test_virtual_packages[micromamba-explicit]": 8.922804991714656 +} \ No newline at end of file From fc60e4a524de50f2441d2faf8690b2372eff3484 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sat, 25 Feb 2023 21:34:08 +0100 Subject: [PATCH 2/5] Add groups --- .github/workflows/test.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dbcc4f4d..4f3f51bf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,6 +17,9 @@ concurrency: jobs: test-windows: + strategy: + matrix: + pytest-split-group: [1, 2, 3, 4] env: PYTHONUNBUFFERED: "1" FORCE_COLOR: "1" @@ -34,7 +37,7 @@ jobs: - name: Install dev deps run: | conda activate test - mamba install pip pytest-cov pytest-xdist + mamba install pip pytest-cov pytest-xdist pytest-split python -m pip install -r requirements-dev.txt - name: install conda-lock @@ -50,7 +53,7 @@ jobs: pushd "${RUNNER_TEMP}" set TMPDIR="%RUNNER_TEMP%" dir - pytest --cov=conda_lock --cov-branch --cov-report=xml --cov-report=term tests + pytest --cov=conda_lock --cov-branch --cov-report=xml --cov-report=term --splits 4 --group ${{ matrix.pytest-split-group }} tests copy coverage.xml %GITHUB_WORKSPACE% - uses: codecov/codecov-action@v3 @@ -61,6 +64,7 @@ jobs: matrix: os: [ ubuntu-latest, macos-latest ] python-version: [ "3.8", "3.11" ] + pytest-split-group: [1, 2] defaults: run: shell: bash -l {0} @@ -81,7 +85,7 @@ jobs: - name: Install dev deps run: | conda activate test - mamba install pip pytest-cov pytest-xdist + mamba install pip pytest-cov pytest-xdist pytest-split set -x echo "${PATH}" which pip @@ -106,7 +110,7 @@ jobs: ls -lah set -x which pytest - pytest --cov=conda_lock --cov-branch --cov-report=xml --cov-report=term tests + pytest --cov=conda_lock --cov-branch --cov-report=xml --cov-report=term --splits 4 --group ${{ matrix.pytest-split-group }} tests cp coverage.xml "${GITHUB_WORKSPACE}" - uses: codecov/codecov-action@v3 From 1f12c99d32f50794e3c6b8e81c44133ef654807b Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sat, 25 Feb 2023 22:53:00 +0100 Subject: [PATCH 3/5] Use variable number of pytest splits --- .github/workflows/test.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4f3f51bf..b25d40f6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,8 @@ jobs: test-windows: strategy: matrix: - pytest-split-group: [1, 2, 3, 4] + pytest-split-group: [1, 2, 3, 4, 5] + pytest-split-groups: [5] env: PYTHONUNBUFFERED: "1" FORCE_COLOR: "1" @@ -53,7 +54,7 @@ jobs: pushd "${RUNNER_TEMP}" set TMPDIR="%RUNNER_TEMP%" dir - pytest --cov=conda_lock --cov-branch --cov-report=xml --cov-report=term --splits 4 --group ${{ matrix.pytest-split-group }} tests + pytest --cov=conda_lock --cov-branch --cov-report=xml --cov-report=term --splits ${{ matrix.pytest-split-groups }} --group ${{ matrix.pytest-split-group }} tests copy coverage.xml %GITHUB_WORKSPACE% - uses: codecov/codecov-action@v3 @@ -64,7 +65,13 @@ jobs: matrix: os: [ ubuntu-latest, macos-latest ] python-version: [ "3.8", "3.11" ] - pytest-split-group: [1, 2] + include: + - os: ubuntu-latest + pytest-split-group: [1, 2] + pytest-split-groups: 2 + - os: macos-latest + pytest-split-group: [1, 2, 3] + pytest-split-groups: 3 defaults: run: shell: bash -l {0} @@ -110,7 +117,7 @@ jobs: ls -lah set -x which pytest - pytest --cov=conda_lock --cov-branch --cov-report=xml --cov-report=term --splits 4 --group ${{ matrix.pytest-split-group }} tests + pytest --cov=conda_lock --cov-branch --cov-report=xml --cov-report=term --splits ${{ matrix.pytest-split-group }} --group ${{ matrix.pytest-split-group }} tests cp coverage.xml "${GITHUB_WORKSPACE}" - uses: codecov/codecov-action@v3 From 951906ea89f46e2232f6d8442a8c3553b217f83f Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sat, 25 Feb 2023 23:01:39 +0100 Subject: [PATCH 4/5] Fix strategy matrix --- .github/workflows/test.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b25d40f6..f90c9d44 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -65,13 +65,18 @@ jobs: matrix: os: [ ubuntu-latest, macos-latest ] python-version: [ "3.8", "3.11" ] - include: + pytest-split-group: [1, 2, 3] + pytest-split-groups: [2, 3] + exclude: - os: ubuntu-latest - pytest-split-group: [1, 2] - pytest-split-groups: 2 - - os: macos-latest - pytest-split-group: [1, 2, 3] + # Force pytest-split-groups to 2 by excluding 3 pytest-split-groups: 3 + - os: macos-latest + # Force pytest-split-groups to 3 by excluding 2 + pytest-split-groups: 2 + - os: ubuntu-latest + # Don't run the third group on ubuntu + pytest-split-group: 3 defaults: run: shell: bash -l {0} From 8edcc53dcf8a0071ec9e044d036fd93ab8fdf830 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sat, 25 Feb 2023 23:12:35 +0100 Subject: [PATCH 5/5] Don't fail fast on Windows --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f90c9d44..9a4c5d9d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,6 +18,7 @@ concurrency: jobs: test-windows: strategy: + fail-fast: false matrix: pytest-split-group: [1, 2, 3, 4, 5] pytest-split-groups: [5]