Phil Dawson pushed to branch phil/external-plugin-testing at BuildStream / buildstream
Commits:
2 changed files:
Changes:
... | ... | @@ -4,12 +4,15 @@ import os |
4 | 4 |
import shutil
|
5 | 5 |
import time
|
6 | 6 |
|
7 |
-BST_SOURCE_PATH = '~/Projects/bl019/buildstream/buildstream'
|
|
8 |
-PYTEST_ARGS = ['--cov-config=~/Projects/bl019/buildstream/.coveragerc',
|
|
9 |
- '--cov-append',] #'--cov={}'.format(BST_SOURCE_PATH), '--cov-append']
|
|
7 |
+BST_SOURCE_PATH = ''
|
|
8 |
+PYTEST_ARGS = [ # '--cov-config=~/Projects/bl019/buildstream/.coveragerc',
|
|
9 |
+ '--cov-append',
|
|
10 |
+ '--cov={}'.format(BST_SOURCE_PATH), '--cov-append']
|
|
10 | 11 |
TEST_COMMAND = ['pytest', *PYTEST_ARGS]
|
12 |
+ |
|
13 |
+ |
|
11 | 14 |
class ExternalPluginRepo():
|
12 |
- def __init__(self,
|
|
15 |
+ def __init__(self,
|
|
13 | 16 |
name=None,
|
14 | 17 |
url=None,
|
15 | 18 |
ref=None,
|
... | ... | @@ -21,28 +24,27 @@ class ExternalPluginRepo(): |
21 | 24 |
|
22 | 25 |
self._clone_location = None
|
23 | 26 |
|
24 |
- |
|
25 | 27 |
def clone(self, location):
|
26 | 28 |
self._clone_location = os.path.join(location, self.name)
|
27 |
- subprocess.run(['git','clone',
|
|
28 |
- '--single-branch',
|
|
29 |
- '--branch', 'master',
|
|
30 |
- '--depth', '1',
|
|
31 |
- self.url,
|
|
32 |
- self._clone_location,
|
|
33 |
- ])
|
|
29 |
+ subprocess.run(['git', 'clone',
|
|
30 |
+ '--single-branch',
|
|
31 |
+ '--branch', 'master',
|
|
32 |
+ '--depth', '1',
|
|
33 |
+ self.url,
|
|
34 |
+ self._clone_location,
|
|
35 |
+ ])
|
|
34 | 36 |
return self._clone_location
|
35 | 37 |
|
36 | 38 |
def install(self):
|
37 |
- subprocess.run(['pip3','install', self._clone_location])
|
|
39 |
+ subprocess.run(['pip3', 'install', self._clone_location])
|
|
38 | 40 |
|
39 | 41 |
def test(self, pytest_args):
|
40 |
- return pytest.main(PYTEST_ARGS
|
|
41 |
- + pytest_args
|
|
42 |
- + [os.path.join(self._clone_location, 'tests')]
|
|
43 |
- )
|
|
42 |
+ return pytest.main(PYTEST_ARGS
|
|
43 |
+ + pytest_args
|
|
44 |
+ + [os.path.join(self._clone_location, 'tests')]
|
|
45 |
+ )
|
|
46 |
+ |
|
44 | 47 |
|
45 |
-
|
|
46 | 48 |
def run_repo_tests(repo, tmpdir, pytest_args):
|
47 | 49 |
print("Cloning repo {} to {}...".format(repo.name, tmpdir))
|
48 | 50 |
repo.clone(tmpdir)
|
... | ... | @@ -59,7 +61,9 @@ if __name__ == "__main__": |
59 | 61 |
|
60 | 62 |
print('Args: ', argv)
|
61 | 63 |
|
62 |
- _, test_dir, *pytest_args = argv
|
|
64 |
+ _, bst_source_dir, test_dir, *pytest_args = argv
|
|
65 |
+ |
|
66 |
+ BST_SOURCE_PATH = bst_source_dir
|
|
63 | 67 |
|
64 | 68 |
bst_external = ExternalPluginRepo(
|
65 | 69 |
name='bst-external',
|
... | ... | @@ -12,14 +12,14 @@ skip_missing_interpreters = true |
12 | 12 |
#
|
13 | 13 |
[testenv]
|
14 | 14 |
commands =
|
15 |
- pytest --basetemp {envtmpdir} {toxinidir}/tests/frontend/completions.py
|
|
16 |
- find {envdir} -name .coverage
|
|
17 |
- mkdir -p .coverage-reports
|
|
18 |
- cp {envtmpdir}/.coverage {toxinidir}/.coverage-reports/.coverage.{env:COVERAGE_PREFIX:}{envname}
|
|
19 |
- - coverage combine --rcfile={toxinidir}/.coveragerc {toxinidir}/.coverage-reports/
|
|
20 |
- - coverage report --rcfile={toxinidir}/.coveragerc -m
|
|
15 |
+ # pytest --basetemp {envtmpdir} {toxinidir}/tests/frontend/completions.py
|
|
16 |
+ # find {envdir} -name .coverage
|
|
17 |
+ # mkdir -p .coverage-reports
|
|
18 |
+ # cp {envtmpdir}/.coverage {toxinidir}/.coverage-reports/.coverage.{env:COVERAGE_PREFIX:}{envname}
|
|
19 |
+ # - coverage combine --rcfile={toxinidir}/.coveragerc {toxinidir}/.coverage-reports/
|
|
20 |
+ # - coverage report --rcfile={toxinidir}/.coveragerc -m
|
|
21 | 21 |
pip3 install -e {toxinidir}
|
22 |
- {envpython} {toxinidir}/tests/external_plugins.py {envtmpdir} {posargs}
|
|
22 |
+ {envpython} {toxinidir}/buildstream/ {toxinidir}/tests/external_plugins.py {envtmpdir} {posargs}
|
|
23 | 23 |
find {envdir} -name .coverage
|
24 | 24 |
mv {envtmpdir}/.coverage {toxinidir}/.coverage-reports/.coverage.{env:COVERAGE_PREFIX:}{envname}
|
25 | 25 |
- coverage combine --rcfile={toxinidir}/.coveragerc {toxinidir}/.coverage-reports/
|