From 86bd0e95c8ae0aaadb3b6dd3b12a0e71744501c7 Mon Sep 17 00:00:00 2001 From: Eric Dill Date: Sun, 10 Jul 2022 09:46:54 -0400 Subject: [PATCH 1/5] Add instructions for installing the pre-commit hooks --- CONTRIBUTING.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 141a36316..4a9409c8e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,9 +4,11 @@ For the most up-to-date instructions see the github actions [test.yml workflow](./github/workflows.test.yml) 1. Install conda and mamba -1. mamba create -n test pip pytest-cov pytest-xdist pip -1. conda activate test -1. python -m pip install -r requirements.txt -1. python -m pip install -r requirements-dev.txt -1. pip install -e . --no-deps --force-reinstall -1. pytest -n auto -vrsx --cov=conda_lock tests \ No newline at end of file +1. `mamba create -n test pip pytest-cov pytest-xdist pip` +1. `conda activate test` +1. `python -m pip install -r requirements.txt` +1. `python -m pip install -r requirements-dev.txt` +1. `pip install -e . --no-deps --force-reinstall` +1. `pytest -n auto -vrsx --cov=conda_lock tests` +1. `pre-commit` + From f6bbb801f8ad6e68b47c3d0606119f812a2b98c8 Mon Sep 17 00:00:00 2001 From: Eric Dill Date: Mon, 11 Jul 2022 08:39:15 -0500 Subject: [PATCH 2/5] Update CONTRIBUTING.md Co-authored-by: Marius van Niekerk --- CONTRIBUTING.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4a9409c8e..3788fb0c6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,5 +10,7 @@ For the most up-to-date instructions see the github actions [test.yml workflow]( 1. `python -m pip install -r requirements-dev.txt` 1. `pip install -e . --no-deps --force-reinstall` 1. `pytest -n auto -vrsx --cov=conda_lock tests` -1. `pre-commit` +Whilst not strictly necessary; the CI run using github actions will run pre-commit -- so in order to reduce development friction you may want to install and activate[ pre-commit +](https://pre-commit.com/) +1. `pre-commit install` From ba31ef916bc8ab517170f3e345e5a0164aab5054 Mon Sep 17 00:00:00 2001 From: Eric Dill Date: Mon, 11 Jul 2022 09:21:26 -0500 Subject: [PATCH 3/5] Add some more patterns to ignore test files emitted during testing --- .gitignore | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 112dccf1c..922c2c087 100644 --- a/.gitignore +++ b/.gitignore @@ -10,5 +10,9 @@ dist/ venv/ test_install*.yml test_install*.lock +tests/**/*.lock +tests/**/*.yml +tests/**/*.bak site/ -filelock \ No newline at end of file +filelock +.coverage \ No newline at end of file From 129eb0acce804793f94852b179d607d351aee69f Mon Sep 17 00:00:00 2001 From: Eric Dill Date: Mon, 11 Jul 2022 09:21:49 -0500 Subject: [PATCH 4/5] Add pytest flags to the setup.cfg so pytest invocation requires nothing other than `pytest` --- setup.cfg | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/setup.cfg b/setup.cfg index d12c303ed..d360cfa1c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,9 +1,14 @@ [tool:pytest] +addopts = -vrsx -n auto flake8-max-line-length = 105 flake8-ignore = docs/* ALL conda_lock/_version.py ALL +[coverage:run] +omit = conda_lock/vendor/* +source = conda_lock/* + [metadata] name = conda_lock description = Lockfiles for conda From 0348a43dcbae94c9398460324dca4b1945675961 Mon Sep 17 00:00:00 2001 From: Eric Dill Date: Mon, 11 Jul 2022 09:22:15 -0500 Subject: [PATCH 5/5] improve contributing docs --- CONTRIBUTING.md | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3788fb0c6..fc316fb22 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,14 +3,18 @@ For the most up-to-date instructions see the github actions [test.yml workflow](./github/workflows.test.yml) -1. Install conda and mamba -1. `mamba create -n test pip pytest-cov pytest-xdist pip` -1. `conda activate test` -1. `python -m pip install -r requirements.txt` -1. `python -m pip install -r requirements-dev.txt` -1. `pip install -e . --no-deps --force-reinstall` -1. `pytest -n auto -vrsx --cov=conda_lock tests` -Whilst not strictly necessary; the CI run using github actions will run pre-commit -- so in order to reduce development friction you may want to install and activate[ pre-commit -](https://pre-commit.com/) -1. `pre-commit install` +1. Ensure conda and mamba are installed. Install [mambaforge](https://github.com/conda-forge/miniforge#mambaforge) if you're otherwise not sure which one to pick. +2. `mamba create -n conda-lock-dev pip pytest-cov pytest-xdist pip` +3. `conda activate conda-lock-dev` +4. `python -m pip install -r requirements.txt` +5. `python -m pip install -r requirements-dev.txt` +6. `pip install -e . --no-deps --force-reinstall` + +Run the tests to ensure that everything is running correctly. Due to the nature of this project, it hits remote webservers regularly so some tests occasionally fail. This is a normal part of conda-lock development. If you're not sure if your env is borked or the remote webserver is just being flaky, run the tests again. If you're still not sure you can open an issue about. + +7. `pytest` + +Whilst not strictly necessary; the CI run using github actions will run pre-commit in order to reduce development friction you may want to install the pre-commit hooks: + +8. `pre-commit install`