summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandan Singh <chandan@chandansingh.net>2019-12-06 15:14:32 +0000
committerChandan Singh <chandan@chandansingh.net>2019-12-10 09:02:03 +0000
commit9beec3b7833012daea332fa2d3251655b133d6a6 (patch)
tree4a704e67475ab97510c1e00027be9462ac8d7cf5
parentc39c12ec8e5ea99de56f70904408dd41c037820d (diff)
downloadbuildstream-9beec3b7833012daea332fa2d3251655b133d6a6.tar.gz
Drop support for `setup.py test`chandan/remote-setuppy-test
Drop support for running tests via `setup.py test`, that is considered deprecated. `tox` is our primary frontend for running tests, so this change ensures that we don't have to support multiple ways of running tests. For testing against a specific installation environment, `tox` is not quite practical. But in these cases, one can run `pytest` directly. So, there is no need for this additional indirection. This was discussed in the following mailing list thread: https://mail.gnome.org/archives/buildstream-list/2019-December/msg00006.html.
-rw-r--r--doc/source/hacking/using_the_testsuite.rst24
-rw-r--r--setup.cfg3
-rwxr-xr-xsetup.py44
3 files changed, 15 insertions, 56 deletions
diff --git a/doc/source/hacking/using_the_testsuite.rst b/doc/source/hacking/using_the_testsuite.rst
index 0e476c7de..720c910c4 100644
--- a/doc/source/hacking/using_the_testsuite.rst
+++ b/doc/source/hacking/using_the_testsuite.rst
@@ -120,21 +120,27 @@ can run ``tox`` with ``-r`` or ``--recreate`` option.
execute the test suite against a specific installation environment
using pytest directly::
- ./setup.py test
-
- Specific options can be passed to ``pytest`` using the ``--addopts``
- option::
-
- ./setup.py test --addopts 'tests/frontend/buildtrack.py::test_build_track'
+ pytest
If you want to run coverage, you will need need to add ``BST_CYTHON_TRACE=1``
to your environment if you also want coverage on cython files. You could then
get coverage by running::
- BST_CYTHON_TRACE=1 coverage run ./setup.py test
+ BST_CYTHON_TRACE=1 coverage run pytest
+
+ Note that you will have to have all dependencies installed already, when
+ running tests directly via ``pytest``. This includes the following:
+
+ * Cython and Setuptools, as build dependencies
+ * Runtime dependencies and test dependencies are specified in requirements
+ files, present in the ``requirements`` subdirectory. Refer to the ``.in``
+ files for loose dependencies and ``.txt`` files for fixed version of all
+ dependencies that are known to work.
+ * Additionally, if you are running tests that involve external plugins, you
+ will need to have those installed as well.
- Note that to be able to run ``./setup.py test``, you will need to have ``Cython``
- installed.
+ You can also have a look at our tox configuration in ``tox.ini`` file if you
+ are unsure about dependencies.
.. tip::
diff --git a/setup.cfg b/setup.cfg
index 363758652..c22120aa1 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -7,9 +7,6 @@ tag_prefix =
tag_regex = *.*.*
parentdir_prefix = BuildStream-
-[aliases]
-test=pytest
-
[tool:pytest]
addopts = --verbose --basetemp ./tmp --durations=20
norecursedirs = tests/integration/project integration-cache tmp __pycache__ .eggs
diff --git a/setup.py b/setup.py
index 19779fb69..7c546e798 100755
--- a/setup.py
+++ b/setup.py
@@ -44,7 +44,6 @@ if sys.version_info[0] != REQUIRED_PYTHON_MAJOR or sys.version_info[1] < REQUIRE
try:
from setuptools import setup, find_packages, Command, Extension
from setuptools.command.easy_install import ScriptWriter
- from setuptools.command.test import test as TestCommand
except ImportError:
print("BuildStream requires setuptools in order to build. Install it using"
" your package manager (usually python3-setuptools) or via pip (pip3"
@@ -245,48 +244,9 @@ class BuildGRPC(Command):
f.write(code)
-#####################################################
-# Pytest command #
-#####################################################
-class PyTest(TestCommand):
- """Defines a pytest command class to run tests from setup.py"""
-
- user_options = TestCommand.user_options + [
- ("addopts=", None, "Arguments to pass to pytest"),
- ('index-url=', None, "Specify an index url from which to retrieve "
- "dependencies"),
- ]
-
- # pylint: disable=attribute-defined-outside-init
- def initialize_options(self):
- super().initialize_options()
- self.addopts = ""
- self.index_url = None
-
- def run(self):
- if self.index_url is not None:
- if self.distribution.command_options.get("easy_install") is None:
- self.distribution.command_options["easy_install"] = {}
-
- self.distribution.command_options["easy_install"]["index_url"] = (
- "cmdline", self.index_url,
- )
- super().run()
-
- def run_tests(self):
- import shlex
- import pytest
-
- errno = pytest.main(shlex.split(self.addopts))
-
- if errno:
- raise SystemExit(errno)
-
-
def get_cmdclass():
cmdclass = {
'build_grpc': BuildGRPC,
- 'pytest': PyTest,
}
cmdclass.update(versioneer.get_cmdclass())
return cmdclass
@@ -295,9 +255,6 @@ def get_cmdclass():
#####################################################
# Gather requirements #
#####################################################
-with open('requirements/dev-requirements.in') as dev_reqs:
- dev_requires = dev_reqs.read().splitlines()
-
with open('requirements/requirements.in') as install_reqs:
install_requires = install_reqs.read().splitlines()
@@ -468,7 +425,6 @@ setup(name='BuildStream',
],
install_requires=install_requires,
entry_points=bst_install_entry_points,
- tests_require=dev_requires,
ext_modules=cythonize(
BUILD_EXTENSIONS,
compiler_directives={