diff options
author | Chandan Singh <csingh43@bloomberg.net> | 2018-08-10 21:33:04 +0100 |
---|---|---|
committer | Chandan Singh <csingh43@bloomberg.net> | 2018-08-11 16:46:05 +0100 |
commit | 95920f48df826dea75e137f00a0abd2ea1d72775 (patch) | |
tree | 6dc784c7b98e79e98a79b2e5fd017099e4da3a04 | |
parent | 2e8db54ea7b0b324f6daa47bc031a146a3eee9fa (diff) | |
download | buildstream-95920f48df826dea75e137f00a0abd2ea1d72775.tar.gz |
Move development reqirements to dev-requirements.txt
In some cases, such as when working inside a virtual environment, it can
be desirable to install all dependencies for running tests using `pip`.
This is currently not possible since setuptools does not support
installing these dependencies in a virtual environment (by design).
(See https://stackoverflow.com/a/21003259.)
To circumvent this issue, move such requirements to
`dev-requirements.txt` file that can be used easily with
`pip install -r`. This also enables tests to be run directly using
`pytest`, which can be more convenient than `-addopts` approach when one
needs to add multiple options.
This will also be useful in creating better testuite images, and fix
some of the issues noticed in
https://gitlab.com/BuildStream/buildstream-docker-images/merge_requests/56.
-rw-r--r-- | MANIFEST.in | 3 | ||||
-rw-r--r-- | dev-requirements.txt | 12 | ||||
-rwxr-xr-x | setup.py | 24 |
3 files changed, 26 insertions, 13 deletions
diff --git a/MANIFEST.in b/MANIFEST.in index 3c8cc64b4..80c815e55 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -21,3 +21,6 @@ recursive-include tests *.expected # Protocol Buffers recursive-include buildstream/_protos *.proto + +# Requirements files +dev-requirements.txt diff --git a/dev-requirements.txt b/dev-requirements.txt new file mode 100644 index 000000000..8b4834fa5 --- /dev/null +++ b/dev-requirements.txt @@ -0,0 +1,12 @@ +# Pin coverage to 4.2 for now, were experiencing +# random crashes with 4.4.2 +coverage == 4.4.0 +pep8 +pytest >= 3.1.0 +pytest-cov >= 2.5.0 +pytest-datafiles +pytest-env +pytest-pep8 +pytest-pylint +# Provide option to run tests in parallel, less reliable +pytest-xdist @@ -219,6 +219,15 @@ def get_cmdclass(): ##################################################### +# Gather requirements # +##################################################### +setup_requires = set(['pytest-runner']) +with open('dev-requirements.txt') as dev_reqs: + dev_requires = set([line for line in dev_reqs.read().split('\n') + if not line.strip().startswith('#')]) + + +##################################################### # Main setup() Invocation # ##################################################### setup(name='BuildStream', @@ -260,17 +269,6 @@ setup(name='BuildStream', 'grpcio >= 1.10', ], entry_points=bst_install_entry_points, - setup_requires=['pytest-runner'], - tests_require=['pep8', - # Pin coverage to 4.2 for now, we're experiencing - # random crashes with 4.4.2 - 'coverage == 4.4.0', - 'pytest-datafiles', - 'pytest-env', - 'pytest-pep8', - 'pytest-pylint', - 'pytest-cov >= 2.5.0', - # Provide option to run tests in parallel, less reliable - 'pytest-xdist', - 'pytest >= 3.1.0'], + setup_requires=list(setup_requires), + tests_require=list(dev_requires - setup_requires), zip_safe=False) |