From 42faff7d3a28a9411532c5b45ed06de2456f15ef Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Fri, 3 Mar 2023 16:07:36 +0200 Subject: Remove test-env makefile target (use tox instead) --- Makefile | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 114f0c7..36bf28a 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,7 @@ test: import-cldr python ${PYTHON_TEST_FLAGS} -m pytest ${PYTEST_FLAGS} -test-env: - virtualenv test-env - test-env/bin/pip install pytest - test-env/bin/pip install --editable . - -clean-test-env: - rm -rf test-env - -standalone-test: import-cldr test-env - test-env/bin/pytest tests ${PYTEST_FLAGS} - -clean: clean-cldr clean-pyc clean-test-env +clean: clean-cldr clean-pyc import-cldr: python scripts/download_import_cldr.py @@ -31,4 +20,4 @@ develop: tox-test: import-cldr tox -.PHONY: test develop tox-test clean-pyc clean-cldr import-cldr clean clean-test-env standalone-test +.PHONY: test develop tox-test clean-pyc clean-cldr import-cldr clean standalone-test -- cgit v1.2.1 From 5b7a128344fcebfdc043574486ee030081357da0 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Fri, 3 Mar 2023 16:19:47 +0200 Subject: makefile: don't import-cldr before tox; it'll clean it --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 36bf28a..05f4d84 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ clean-pyc: develop: pip install --editable . -tox-test: import-cldr +tox-test: tox .PHONY: test develop tox-test clean-pyc clean-cldr import-cldr clean standalone-test -- cgit v1.2.1 From d2c84b793472a6b5239199a6bea875aa3400ced4 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Fri, 3 Mar 2023 16:20:36 +0200 Subject: Move dev dependencies to dev extra --- setup.py | 7 +++++++ tox.ini | 5 ++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index dbc6c60..e168f09 100755 --- a/setup.py +++ b/setup.py @@ -67,6 +67,13 @@ setup( # Python 3.9 and later include zoneinfo which replaces pytz 'pytz>=2015.7; python_version<"3.9"', ], + extras_require={ + 'dev': [ + 'pytest>=6.0', + 'pytest-cov', + 'freezegun~=1.0', + ], + }, cmdclass={'import_cldr': import_cldr}, zip_safe=False, # Note when adding extractors: builtin extractors we also want to diff --git a/tox.ini b/tox.ini index 1156fec..11cca0c 100644 --- a/tox.ini +++ b/tox.ini @@ -5,10 +5,9 @@ envlist = py{37,38}-pytz [testenv] +extras = + dev deps = - pytest>=6.0 - pytest-cov - freezegun==0.3.12 backports.zoneinfo;python_version<"3.9" tzdata;sys_platform == 'win32' pytz: pytz -- cgit v1.2.1 From c6167751d11d6e1934ec8c8473b454d639746cb8 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Fri, 3 Mar 2023 16:26:30 +0200 Subject: Improve CONTRIBUTING.md Refs #985 --- CONTRIBUTING.md | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d634ee7..f773680 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,25 @@ still need proper phrasing - if you'd like to help - be sure to make a PR. Please know that we do appreciate all contributions - bug reports as well as Pull Requests. -## PR Merge Criteria +## Setting up a development environment and running tests + +After you've cloned the repository, + +1. Set up a Python virtualenv (the methods vary depending on tooling and operating system) + and activate it. +2. Install Babel in editable mode with development dependencies: `pip install -e .[dev]` +3. Run `make import-cldr` to import the CLDR database. + This will download the CLDR database and convert it to a format that Babel can use. +4. Run `make test` to run the tests. You can also run e.g. `pytest --cov babel .` to + run the tests with coverage reporting enabled. + +You can also use [Tox][tox] to run the tests in separate virtualenvs +for all supported Python versions; a `tox.ini` configuration (which is what the CI process +uses) is included in the repository. + +## On pull requests + +### PR Merge Criteria For a PR to be merged, the following statements must hold true: @@ -19,14 +37,16 @@ For a PR to be merged, the following statements must hold true: To begin contributing have a look at the open [easy issues](https://github.com/python-babel/babel/issues?q=is%3Aopen+is%3Aissue+label%3Adifficulty%2Flow) which could be fixed. -## Correcting PRs +### Correcting PRs Rebasing PRs is preferred over merging master into the source branches again and again cluttering our history. If a reviewer has suggestions, the commit shall be amended so the history is not cluttered by "fixup commits". -## Writing Good Commits +### Writing Good Commits Please see https://api.coala.io/en/latest/Developers/Writing_Good_Commits.html for guidelines on how to write good commits and proper commit messages. + +[tox]: https://tox.wiki/en/latest/ -- cgit v1.2.1