#24 Refactor testing by introducing tox.
Closed 2 years ago by bignose. Opened 2 years ago by hberaud.
hberaud/python-daemon refactor-tests  into  master

file modified
+8
@@ -192,6 +192,14 @@ 

  development tree when accompanied by corresponding additions or

  changes to the unit tests.

  

+ To launch unit test using the following commands::

+ 

+    $ tox

+ 

+ You can also check specific environment by using::

+ 

+    $ tox -e py37

+ 

  Test-driven development

  -----------------------

  

file removed
-16
@@ -1,16 +0,0 @@ 

This file was added in order to support systems that use it. Why remove it?

If there is a problem in this file, I would like to fix the file and keep its functionality intact.

If there is a problem with some third-party system (e.g. Tox), that does not seem good enough reason to remove this file.

- # pyproject.toml

- # Build system requirements for Python code in this code base.

- # Documentation: <URL:https://www.python.org/dev/peps/pep-0518/>.

- 

- [build-system]

- 

- # Minimum requirements for the build system.

- requires = ["setuptools", "wheel", "docutils"]

- 

- 

- # Local-variables:

- # coding: utf-8

- # mode: conf

- # mode: toml

- # End:

- # vim: fileencoding=utf-8 filetype=toml :

@@ -0,0 +1,5 @@ 

+ unittest2>=0.5.1

+ testtools

+ testscenarios>=0.4

+ mock>=1.3

+ docutils

file added
+13
@@ -0,0 +1,13 @@ 

+ # tox (https://tox.readthedocs.io/) is a tool for running tests

+ # in multiple virtualenvs. This configuration file will run the

+ # test suite on all supported python versions. To use it, "pip install tox"

+ # and then run "tox" from this directory.

+ 

+ [tox]

+ envlist = py35, py36, py37, pep8, docs

+ 

+ [testenv]

+ deps = -r{toxinidir}/test-requirements.txt

+ 

+ commands =

+     python -m unittest discover

Since we have propose to refactor the project
release management by using pbr we now propose with this
commit to refactor testing by using tox[1].

Why using tox? tox introduce virtualenv for testing
and allow to test your project with multiple version
of python in the same time. Also tox is a standard tools
in python community and made the testing more straightforward
for your contributors and maintainers.

This commit introduce:
- introduce requirements file for tests dependancies;
- remove PEP 518 since pbr was introduced and your pyproject.toml was incompatible with tox;
- improve hacking doc by explain to your contributors how to test theirs changes.

Using it:
- install tox (pip install tox);
- launch tests (tox)

tox[1] allow simplify python testing by introducing:
- virtualenv;
- specific targets;
- cross testing;
- integrated with many CI platforms.

In order merge this pull request before => https://pagure.io/python-daemon/pull-request/23

[1] https://tox.readthedocs.io/en/latest/

Co-authored-by: Hobbestigrou hobbestigrou@erakis.eu

rebased onto 99324f5

2 years ago

Please be careful to merge these pull requests in order:

  1. 23

  2. 24

  3. 25

  4. 26

Thank you

Thank you for this suggestion, I will look through it.

You have included this change:

remove PEP 518 since pbr was introduced and your pyproject.toml was incompatible with tox

Is that a bug in Tox? Or a problem wih the pyproject.toml file?

I would prefer either of those being corrected, not removing the file.

This file was added in order to support systems that use it. Why remove it?

If there is a problem in this file, I would like to fix the file and keep its functionality intact.

If there is a problem with some third-party system (e.g. Tox), that does not seem good enough reason to remove this file.

Thanks for the suggestion. I have implemented this differently, by:

  • Fixing a bug in the pyproject.toml file.
  • Implementing Pip requirements declarations for different purposes.
  • Configuring Tox for the project.

Pull-Request has been closed by bignose

2 years ago