Chandan Singh pushed to branch chandan/toxify at BuildStream / buildstream
Commits:
-
a080b6c7
by Tristan Van Berkom at 2018-12-31T19:03:25Z
-
d7c8b54d
by Tristan Van Berkom at 2018-12-31T19:14:16Z
-
560a6342
by Tristan Van Berkom at 2018-12-31T19:49:24Z
-
8a020a5a
by Chandan Singh at 2018-12-31T19:54:25Z
-
87568074
by Chandan Singh at 2018-12-31T19:54:25Z
-
4b2992c1
by Chandan Singh at 2018-12-31T19:54:25Z
-
ce9e9c2d
by Chandan Singh at 2018-12-31T19:54:25Z
-
b848172c
by Tristan Van Berkom at 2018-12-31T20:29:51Z
-
bb9df2a1
by Chandan Singh at 2019-01-02T11:59:35Z
-
43eaf6ee
by Chandan Singh at 2019-01-02T13:42:10Z
-
3b5c8a28
by Tristan Maat at 2019-01-02T15:57:13Z
-
bd60e8a9
by Javier Jardón at 2019-01-02T16:59:41Z
-
32c47d1c
by Tristan Maat at 2019-01-02T17:32:09Z
-
7db52726
by Chandan Singh at 2019-01-02T19:12:30Z
-
24a2d90a
by Chandan Singh at 2019-01-02T19:12:30Z
-
8ff9c051
by Chandan Singh at 2019-01-02T19:12:30Z
-
73dbbb8e
by Tristan Van Berkom at 2019-01-02T19:12:30Z
-
99e0d552
by Chandan Singh at 2019-01-02T19:12:30Z
-
dc34c08d
by Chandan Singh at 2019-01-02T19:12:30Z
-
3ad3bdb1
by Chandan Singh at 2019-01-02T19:13:25Z
27 changed files:
- .gitignore
- .gitlab-ci.yml
- CONTRIBUTING.rst
- MANIFEST.in
- buildstream/_loader/loader.py
- buildstream/_ostree.py
- buildstream/_signals.py
- buildstream/element.py
- buildstream/types.py
- doc/Makefile
- doc/source/format_declaring.rst
- setup.cfg
- setup.py
- tests/frontend/buildcheckout.py
- + tests/frontend/project/elements/invalid-chars-in-dep.bst
- + tests/frontend/project/elements/invalid-chars|<>-in-name.bst
- tests/frontend/project/project.conf
- tests/loader/junctions.py
- + tests/loader/junctions/invalid/missing-element.bst
- tests/testutils/http_server.py
- dev-requirements.txt → tools/dev-requirements.in
- + tools/dev-requirements.txt
- + tools/plugin-requirements.in
- + tools/plugin-requirements.txt
- + tools/requirements.in
- + tools/requirements.txt
- + tox.ini
Changes:
... | ... | @@ -17,6 +17,7 @@ tmp |
17 | 17 |
.cache
|
18 | 18 |
.pytest_cache/
|
19 | 19 |
*.bst/
|
20 |
+.tox
|
|
20 | 21 |
|
21 | 22 |
# Pycache, in case buildstream is ran directly from within the source
|
22 | 23 |
# tree
|
1 |
-image: buildstream/testsuite-debian:9-master-123-7ce6581b
|
|
1 |
+image: buildstream/testsuite-debian:9-06bab030-b848172c
|
|
2 | 2 |
|
3 | 3 |
cache:
|
4 | 4 |
key: "$CI_JOB_NAME-"
|
... | ... | @@ -13,7 +13,7 @@ stages: |
13 | 13 |
variables:
|
14 | 14 |
PYTEST_ADDOPTS: "--color=yes"
|
15 | 15 |
INTEGRATION_CACHE: "${CI_PROJECT_DIR}/cache/integration-cache"
|
16 |
- TEST_COMMAND: 'python3 setup.py test --index-url invalid://uri --addopts --integration'
|
|
16 |
+ TEST_COMMAND: 'tox -- --color=yes --integration'
|
|
17 | 17 |
|
18 | 18 |
#####################################################
|
19 | 19 |
# Prepare stage #
|
... | ... | @@ -67,10 +67,10 @@ source_dist: |
67 | 67 |
# Diagnostics
|
68 | 68 |
- mount
|
69 | 69 |
- df -h
|
70 |
- |
|
71 |
- # Unpack
|
|
72 |
- - cd dist && ./unpack.sh
|
|
73 |
- - cd buildstream
|
|
70 |
+ # FIXME: this deps should ideally be provided by the testsuite images
|
|
71 |
+ - pip3 install tox
|
|
72 |
+ - |
|
|
73 |
+ bash -c '( apt-get update && apt-get install -y python3-dev gcc libcairo2-dev pkg-config libgirepository1.0-dev ) || ( dnf install -y gcc python3-devel gobject-introspection-devel glib2-devel cairo-gobject-devel )'
|
|
74 | 74 |
|
75 | 75 |
script:
|
76 | 76 |
- useradd -Um buildstream
|
... | ... | @@ -83,7 +83,7 @@ source_dist: |
83 | 83 |
after_script:
|
84 | 84 |
# Collect our reports
|
85 | 85 |
- mkdir -p ${COVERAGE_DIR}
|
86 |
- - cp dist/buildstream/.coverage ${COVERAGE_DIR}/coverage."${CI_JOB_NAME}"
|
|
86 |
+ - cp .coverage ${COVERAGE_DIR}/coverage."${CI_JOB_NAME}"
|
|
87 | 87 |
except:
|
88 | 88 |
- schedules
|
89 | 89 |
artifacts:
|
... | ... | @@ -91,23 +91,23 @@ source_dist: |
91 | 91 |
- ${COVERAGE_DIR}
|
92 | 92 |
|
93 | 93 |
tests-debian-9:
|
94 |
- image: buildstream/testsuite-debian:9-master-123-7ce6581b
|
|
94 |
+ image: buildstream/testsuite-debian:9-06bab030-b848172c
|
|
95 | 95 |
<<: *tests
|
96 | 96 |
|
97 | 97 |
tests-fedora-27:
|
98 |
- image: buildstream/testsuite-fedora:27-master-123-7ce6581b
|
|
98 |
+ image: buildstream/testsuite-fedora:27-06bab030-b848172c
|
|
99 | 99 |
<<: *tests
|
100 | 100 |
|
101 | 101 |
tests-fedora-28:
|
102 |
- image: buildstream/testsuite-fedora:28-master-123-7ce6581b
|
|
102 |
+ image: buildstream/testsuite-fedora:28-06bab030-b848172c
|
|
103 | 103 |
<<: *tests
|
104 | 104 |
|
105 | 105 |
tests-ubuntu-18.04:
|
106 |
- image: buildstream/testsuite-ubuntu:18.04-master-123-7ce6581b
|
|
106 |
+ image: buildstream/testsuite-ubuntu:18.04-06bab030-b848172c
|
|
107 | 107 |
<<: *tests
|
108 | 108 |
|
109 | 109 |
overnight-fedora-28-aarch64:
|
110 |
- image: buildstream/testsuite-fedora:aarch64-28-master-123-7ce6581b
|
|
110 |
+ image: buildstream/testsuite-fedora:aarch64-28-06bab030-32a101f6
|
|
111 | 111 |
tags:
|
112 | 112 |
- aarch64
|
113 | 113 |
<<: *tests
|
... | ... | @@ -120,7 +120,7 @@ overnight-fedora-28-aarch64: |
120 | 120 |
tests-unix:
|
121 | 121 |
# Use fedora here, to a) run a test on fedora and b) ensure that we
|
122 | 122 |
# can get rid of ostree - this is not possible with debian-8
|
123 |
- image: buildstream/testsuite-fedora:27-master-123-7ce6581b
|
|
123 |
+ image: buildstream/testsuite-fedora:27-06bab030-b848172c
|
|
124 | 124 |
<<: *tests
|
125 | 125 |
variables:
|
126 | 126 |
BST_FORCE_BACKEND: "unix"
|
... | ... | @@ -140,7 +140,7 @@ tests-unix: |
140 | 140 |
|
141 | 141 |
tests-fedora-missing-deps:
|
142 | 142 |
# Ensure that tests behave nicely while missing bwrap and ostree
|
143 |
- image: buildstream/testsuite-fedora:28-master-123-7ce6581b
|
|
143 |
+ image: buildstream/testsuite-fedora:28-06bab030-b848172c
|
|
144 | 144 |
<<: *tests
|
145 | 145 |
|
146 | 146 |
script:
|
... | ... | @@ -158,20 +158,18 @@ tests-fedora-missing-deps: |
158 | 158 |
|
159 | 159 |
# Automatically build documentation for every commit, we want to know
|
160 | 160 |
# if building documentation fails even if we're not deploying it.
|
161 |
-# Note: We still do not enforce a consistent installation of python3-sphinx,
|
|
162 |
-# as it will significantly grow the backing image.
|
|
163 | 161 |
docs:
|
164 | 162 |
stage: test
|
163 |
+ variables:
|
|
164 |
+ BST_FORCE_SESSION_REBUILD: 1
|
|
165 |
+ before_script:
|
|
166 |
+ # FIXME: this deps should ideally be provided by the testsuite images
|
|
167 |
+ - pip3 install tox
|
|
168 |
+ - |
|
|
169 |
+ bash -c '( apt-get update && apt-get install -y python3-dev gcc libcairo2-dev pkg-config libgirepository1.0-dev ) || ( dnf install -y gcc python3-devel gobject-introspection-devel glib2-devel cairo-gobject-devel )'
|
|
165 | 170 |
script:
|
166 |
- - export BST_SOURCE_CACHE="$(pwd)/cache/integration-cache/sources"
|
|
167 |
- # Currently sphinx_rtd_theme does not support Sphinx >1.8, this breaks search functionality
|
|
168 |
- - pip3 install sphinx==1.7.9
|
|
169 |
- - pip3 install sphinx-click
|
|
170 |
- - pip3 install sphinx_rtd_theme
|
|
171 |
- - cd dist && ./unpack.sh && cd buildstream
|
|
172 |
- - make BST_FORCE_SESSION_REBUILD=1 -C doc
|
|
173 |
- - cd ../..
|
|
174 |
- - mv dist/buildstream/doc/build/html public
|
|
171 |
+ - env BST_SOURCE_CACHE="$(pwd)/cache/integration-cache/sources" tox -e docs
|
|
172 |
+ - mv doc/build/html public
|
|
175 | 173 |
except:
|
176 | 174 |
- schedules
|
177 | 175 |
artifacts:
|
... | ... | @@ -1222,27 +1222,13 @@ For further information about using the reStructuredText with sphinx, please see |
1222 | 1222 |
|
1223 | 1223 |
Building Docs
|
1224 | 1224 |
~~~~~~~~~~~~~
|
1225 |
-The documentation build is not integrated into the ``setup.py`` and is
|
|
1226 |
-difficult (or impossible) to do so, so there is a little bit of setup
|
|
1227 |
-you need to take care of first.
|
|
1228 |
- |
|
1229 |
-Before you can build the BuildStream documentation yourself, you need
|
|
1230 |
-to first install ``sphinx`` along with some additional plugins and dependencies,
|
|
1231 |
-using pip or some other mechanism::
|
|
1232 |
- |
|
1233 |
- # Install sphinx
|
|
1234 |
- pip3 install --user sphinx
|
|
1235 |
- |
|
1236 |
- # Install some sphinx extensions
|
|
1237 |
- pip3 install --user sphinx-click
|
|
1238 |
- pip3 install --user sphinx_rtd_theme
|
|
1239 |
- |
|
1240 |
- # Additional optional dependencies required
|
|
1241 |
- pip3 install --user arpy
|
|
1225 |
+Before you can build the docs, you will end to ensure that you have installed
|
|
1226 |
+the required :ref:`buid dependencies <contributing_build_deps>` as mentioned
|
|
1227 |
+in the testing section above.
|
|
1242 | 1228 |
|
1243 | 1229 |
To build the documentation, just run the following::
|
1244 | 1230 |
|
1245 |
- make -C doc
|
|
1231 |
+ tox -e docs
|
|
1246 | 1232 |
|
1247 | 1233 |
This will give you a ``doc/build/html`` directory with the html docs which
|
1248 | 1234 |
you can view in your browser locally to test.
|
... | ... | @@ -1260,9 +1246,10 @@ will make the docs build reuse already downloaded sources:: |
1260 | 1246 |
|
1261 | 1247 |
export BST_SOURCE_CACHE=~/.cache/buildstream/sources
|
1262 | 1248 |
|
1263 |
-To force rebuild session html while building the doc, simply build the docs like this::
|
|
1249 |
+To force rebuild session html while building the doc, simply run `tox` with the
|
|
1250 |
+``BST_FORCE_SESSION_REBUILD`` environment variable set, like so::
|
|
1264 | 1251 |
|
1265 |
- make BST_FORCE_SESSION_REBUILD=1 -C doc
|
|
1252 |
+ env BST_FORCE_SESSION_REBUILD=1 tox -e docs
|
|
1266 | 1253 |
|
1267 | 1254 |
|
1268 | 1255 |
Man pages
|
... | ... | @@ -1468,58 +1455,115 @@ regenerate them locally in order to build the docs. |
1468 | 1455 |
|
1469 | 1456 |
Testing
|
1470 | 1457 |
-------
|
1471 |
-BuildStream uses pytest for regression tests and testing out
|
|
1472 |
-the behavior of newly added components.
|
|
1458 |
+BuildStream uses `tox <https://tox.readthedocs.org/>`_ as a frontend to run the
|
|
1459 |
+tests which are implemented using `pytest <https://pytest.org/>`_. We use
|
|
1460 |
+pytest for regression tests and testing out the behavior of newly added
|
|
1461 |
+components.
|
|
1473 | 1462 |
|
1474 | 1463 |
The elaborate documentation for pytest can be found here: http://doc.pytest.org/en/latest/contents.html
|
1475 | 1464 |
|
1476 | 1465 |
Don't get lost in the docs if you don't need to, follow existing examples instead.
|
1477 | 1466 |
|
1478 | 1467 |
|
1468 |
+.. _contributing_build_deps:
|
|
1469 |
+ |
|
1470 |
+Installing build dependencies
|
|
1471 |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
1472 |
+Some of BuildStream's dependencies have non-python build dependencies. When
|
|
1473 |
+running tests with ``tox``, you will first need to install these dependencies.
|
|
1474 |
+Exact steps to install these will depend on your oprtation systemm. Commands
|
|
1475 |
+for installing them for some common distributions are lised below.
|
|
1476 |
+ |
|
1477 |
+For Fedora-based systems::
|
|
1478 |
+ |
|
1479 |
+ dnf install gcc pkg-config python3-devel cairo-gobject-devel glib2-devel gobject-introspection-devel
|
|
1480 |
+ |
|
1481 |
+ |
|
1482 |
+For Debian-based systems::
|
|
1483 |
+ |
|
1484 |
+ apt install gcc pkg-config python3-dev libcairo2-dev libgirepository1.0-dev
|
|
1485 |
+ |
|
1486 |
+ |
|
1479 | 1487 |
Running tests
|
1480 | 1488 |
~~~~~~~~~~~~~
|
1481 |
-To run the tests, just type::
|
|
1489 |
+To run the tests, simply navigate to the toplevel directory of your BuildStream
|
|
1490 |
+checkout and run::
|
|
1482 | 1491 |
|
1483 |
- ./setup.py test
|
|
1492 |
+ tox
|
|
1484 | 1493 |
|
1485 |
-At the toplevel.
|
|
1494 |
+By default, the test suite will be run against every supported python version
|
|
1495 |
+found on your host. If you have multiple python versions installed, you may
|
|
1496 |
+want to run tests against only one version and you can do that using the ``-e``
|
|
1497 |
+option when running tox::
|
|
1486 | 1498 |
|
1487 |
-When debugging a test, it can be desirable to see the stdout
|
|
1488 |
-and stderr generated by a test, to do this use the ``--addopts``
|
|
1489 |
-function to feed arguments to pytest as such::
|
|
1499 |
+ tox -e py37
|
|
1490 | 1500 |
|
1491 |
- ./setup.py test --addopts -s
|
|
1501 |
+The output of all failing tests will always be printed in the summary, but
|
|
1502 |
+if you want to observe the stdout and stderr generated by a passing test,
|
|
1503 |
+you can pass the ``-s`` option to pytest as such::
|
|
1504 |
+ |
|
1505 |
+ tox -- -s
|
|
1506 |
+ |
|
1507 |
+.. tip::
|
|
1508 |
+ |
|
1509 |
+ The ``-s`` option is `a pytest option <https://docs.pytest.org/latest/usage.html>`_.
|
|
1510 |
+ |
|
1511 |
+ Any options specified before the ``--`` separator are consumed by ``tox``,
|
|
1512 |
+ and any options after the ``--`` separator will be passed along to pytest.
|
|
1492 | 1513 |
|
1493 | 1514 |
You can always abort on the first failure by running::
|
1494 | 1515 |
|
1495 |
- ./setup.py test --addopts -x
|
|
1516 |
+ tox -- -x
|
|
1496 | 1517 |
|
1497 | 1518 |
If you want to run a specific test or a group of tests, you
|
1498 | 1519 |
can specify a prefix to match. E.g. if you want to run all of
|
1499 | 1520 |
the frontend tests you can do::
|
1500 | 1521 |
|
1501 |
- ./setup.py test --addopts 'tests/frontend/'
|
|
1522 |
+ tox -- tests/frontend/
|
|
1502 | 1523 |
|
1503 | 1524 |
Specific tests can be chosen by using the :: delimeter after the test module.
|
1504 | 1525 |
If you wanted to run the test_build_track test within frontend/buildtrack.py you could do::
|
1505 | 1526 |
|
1506 |
- ./setup.py test --addopts 'tests/frontend/buildtrack.py::test_build_track'
|
|
1527 |
+ tox -- tests/frontend/buildtrack.py::test_build_track
|
|
1507 | 1528 |
|
1508 | 1529 |
We also have a set of slow integration tests that are disabled by
|
1509 | 1530 |
default - you will notice most of them marked with SKIP in the pytest
|
1510 | 1531 |
output. To run them, you can use::
|
1511 | 1532 |
|
1512 |
- ./setup.py test --addopts '--integration'
|
|
1533 |
+ tox -- --integration
|
|
1513 | 1534 |
|
1514 | 1535 |
By default, buildstream also runs pylint on all files. Should you want
|
1515 | 1536 |
to run just pylint (these checks are a lot faster), you can do so
|
1516 | 1537 |
with::
|
1517 | 1538 |
|
1518 |
- ./setup.py test --addopts '-m pylint'
|
|
1539 |
+ tox -- -m pylint
|
|
1519 | 1540 |
|
1520 | 1541 |
Alternatively, any IDE plugin that uses pytest should automatically
|
1521 | 1542 |
detect the ``.pylintrc`` in the project's root directory.
|
1522 | 1543 |
|
1544 |
+.. note::
|
|
1545 |
+ |
|
1546 |
+ By default, we do not allow use of site packages in our ``tox``
|
|
1547 |
+ confguration to enable running the tests in an isolated environment.
|
|
1548 |
+ If you need to enable use of site packages for whatever reason, you can
|
|
1549 |
+ do so by passing the ``--sitepackages`` option to ``tox``. Also, you will
|
|
1550 |
+ not need to install any of the build dependencies mentioned above if you
|
|
1551 |
+ use this approach.
|
|
1552 |
+ |
|
1553 |
+.. note::
|
|
1554 |
+ |
|
1555 |
+ While using ``tox`` is practical for developers running tests in
|
|
1556 |
+ more predictable execution environments, it is still possible to
|
|
1557 |
+ execute the test suite against a specific installation environment
|
|
1558 |
+ using pytest directly::
|
|
1559 |
+ |
|
1560 |
+ ./setup.py test
|
|
1561 |
+ |
|
1562 |
+ Specific options can be passed to ``pytest`` using the ``--addopts``
|
|
1563 |
+ option::
|
|
1564 |
+ |
|
1565 |
+ ./setup.py test --addopts 'tests/frontend/buildtrack.py::test_build_track'
|
|
1566 |
+ |
|
1523 | 1567 |
|
1524 | 1568 |
Adding tests
|
1525 | 1569 |
~~~~~~~~~~~~
|
... | ... | @@ -24,6 +24,7 @@ recursive-include doc/sessions *.run |
24 | 24 |
# Tests
|
25 | 25 |
recursive-include tests *
|
26 | 26 |
include conftest.py
|
27 |
+include tox.ini
|
|
27 | 28 |
include .coveragerc
|
28 | 29 |
include .pylintrc
|
29 | 30 |
|
... | ... | @@ -31,7 +32,12 @@ include .pylintrc |
31 | 32 |
recursive-include buildstream/_protos *.proto
|
32 | 33 |
|
33 | 34 |
# Requirements files
|
34 |
-include dev-requirements.txt
|
|
35 |
+include tools/requirements.in
|
|
36 |
+include tools/requirements.txt
|
|
37 |
+include tools/dev-requirements.in
|
|
38 |
+include tools/dev-requirements.txt
|
|
39 |
+include tools/plugin-requirements.in
|
|
40 |
+include tools/plugin-requirements.txt
|
|
35 | 41 |
|
36 | 42 |
# Versioneer
|
37 | 43 |
include versioneer.py
|
... | ... | @@ -99,7 +99,6 @@ class Loader(): |
99 | 99 |
# Returns: The toplevel LoadElement
|
100 | 100 |
def load(self, targets, rewritable=False, ticker=None, fetch_subprojects=False):
|
101 | 101 |
|
102 |
- invalid_elements = []
|
|
103 | 102 |
for filename in targets:
|
104 | 103 |
if os.path.isabs(filename):
|
105 | 104 |
# XXX Should this just be an assertion ?
|
... | ... | @@ -109,14 +108,8 @@ class Loader(): |
109 | 108 |
"path to the base project directory: {}"
|
110 | 109 |
.format(filename, self._basedir))
|
111 | 110 |
|
112 |
- if not filename.endswith(".bst"):
|
|
113 |
- invalid_elements.append(filename)
|
|
111 |
+ self._warn_invalid_elements(targets)
|
|
114 | 112 |
|
115 |
- if invalid_elements:
|
|
116 |
- self._warn("Target elements '{}' do not have expected file extension `.bst` "
|
|
117 |
- "Improperly named elements will not be discoverable by commands"
|
|
118 |
- .format(invalid_elements),
|
|
119 |
- warning_token=CoreWarnings.BAD_ELEMENT_SUFFIX)
|
|
120 | 113 |
# First pass, recursively load files and populate our table of LoadElements
|
121 | 114 |
#
|
122 | 115 |
deps = []
|
... | ... | @@ -280,12 +273,7 @@ class Loader(): |
280 | 273 |
self._elements[filename] = element
|
281 | 274 |
|
282 | 275 |
# Load all dependency files for the new LoadElement
|
283 |
- invalid_elements = []
|
|
284 | 276 |
for dep in element.deps:
|
285 |
- if not dep.name.endswith(".bst"):
|
|
286 |
- invalid_elements.append(dep.name)
|
|
287 |
- continue
|
|
288 |
- |
|
289 | 277 |
if dep.junction:
|
290 | 278 |
self._load_file(dep.junction, rewritable, ticker, fetch_subprojects, yaml_cache)
|
291 | 279 |
loader = self._get_loader(dep.junction, rewritable=rewritable, ticker=ticker,
|
... | ... | @@ -300,11 +288,9 @@ class Loader(): |
300 | 288 |
"{}: Cannot depend on junction"
|
301 | 289 |
.format(dep.provenance))
|
302 | 290 |
|
303 |
- if invalid_elements:
|
|
304 |
- self._warn("The following dependencies do not have expected file extension `.bst`: {} "
|
|
305 |
- "Improperly named elements will not be discoverable by commands"
|
|
306 |
- .format(invalid_elements),
|
|
307 |
- warning_token=CoreWarnings.BAD_ELEMENT_SUFFIX)
|
|
291 |
+ deps_names = [dep.name for dep in element.deps]
|
|
292 |
+ self._warn_invalid_elements(deps_names)
|
|
293 |
+ |
|
308 | 294 |
return element
|
309 | 295 |
|
310 | 296 |
# _check_circular_deps():
|
... | ... | @@ -679,3 +665,69 @@ class Loader(): |
679 | 665 |
|
680 | 666 |
message = Message(None, MessageType.WARN, brief)
|
681 | 667 |
self._context.message(message)
|
668 |
+ |
|
669 |
+ # Print warning messages if any of the specified elements have invalid names.
|
|
670 |
+ #
|
|
671 |
+ # Valid filenames should end with ".bst" extension.
|
|
672 |
+ #
|
|
673 |
+ # Args:
|
|
674 |
+ # elements (list): List of element names
|
|
675 |
+ #
|
|
676 |
+ # Raises:
|
|
677 |
+ # (:class:`.LoadError`): When warning_token is considered fatal by the project configuration
|
|
678 |
+ #
|
|
679 |
+ def _warn_invalid_elements(self, elements):
|
|
680 |
+ |
|
681 |
+ # invalid_elements
|
|
682 |
+ #
|
|
683 |
+ # A dict that maps warning types to the matching elements.
|
|
684 |
+ invalid_elements = {
|
|
685 |
+ CoreWarnings.BAD_ELEMENT_SUFFIX: [],
|
|
686 |
+ CoreWarnings.BAD_CHARACTERS_IN_NAME: [],
|
|
687 |
+ }
|
|
688 |
+ |
|
689 |
+ for filename in elements:
|
|
690 |
+ if not filename.endswith(".bst"):
|
|
691 |
+ invalid_elements[CoreWarnings.BAD_ELEMENT_SUFFIX].append(filename)
|
|
692 |
+ if not self._valid_chars_name(filename):
|
|
693 |
+ invalid_elements[CoreWarnings.BAD_CHARACTERS_IN_NAME].append(filename)
|
|
694 |
+ |
|
695 |
+ if invalid_elements[CoreWarnings.BAD_ELEMENT_SUFFIX]:
|
|
696 |
+ self._warn("Target elements '{}' do not have expected file extension `.bst` "
|
|
697 |
+ "Improperly named elements will not be discoverable by commands"
|
|
698 |
+ .format(invalid_elements[CoreWarnings.BAD_ELEMENT_SUFFIX]),
|
|
699 |
+ warning_token=CoreWarnings.BAD_ELEMENT_SUFFIX)
|
|
700 |
+ if invalid_elements[CoreWarnings.BAD_CHARACTERS_IN_NAME]:
|
|
701 |
+ self._warn("Target elements '{}' have invalid characerts in their name."
|
|
702 |
+ .format(invalid_elements[CoreWarnings.BAD_CHARACTERS_IN_NAME]),
|
|
703 |
+ warning_token=CoreWarnings.BAD_CHARACTERS_IN_NAME)
|
|
704 |
+ |
|
705 |
+ # Check if given filename containers valid characters.
|
|
706 |
+ #
|
|
707 |
+ # Args:
|
|
708 |
+ # name (str): Name of the file
|
|
709 |
+ #
|
|
710 |
+ # Returns:
|
|
711 |
+ # (bool): True if all characters are valid, False otherwise.
|
|
712 |
+ #
|
|
713 |
+ def _valid_chars_name(self, name):
|
|
714 |
+ for char in name:
|
|
715 |
+ char_val = ord(char)
|
|
716 |
+ |
|
717 |
+ # 0-31 are control chars, 127 is DEL, and >127 means non-ASCII
|
|
718 |
+ if char_val <= 31 or char_val >= 127:
|
|
719 |
+ return False
|
|
720 |
+ |
|
721 |
+ # Disallow characters that are invalid on Windows. The list can be
|
|
722 |
+ # found at https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file
|
|
723 |
+ #
|
|
724 |
+ # Note that although : (colon) is not allowed, we do not raise
|
|
725 |
+ # warnings because of that, since we use it as a separator for
|
|
726 |
+ # junctioned elements.
|
|
727 |
+ #
|
|
728 |
+ # We also do not raise warnings on slashes since they are used as
|
|
729 |
+ # path separators.
|
|
730 |
+ if char in r'<>"|?*':
|
|
731 |
+ return False
|
|
732 |
+ |
|
733 |
+ return True
|
... | ... | @@ -34,7 +34,7 @@ from ._exceptions import BstError, ErrorDomain |
34 | 34 |
|
35 | 35 |
# pylint: disable=wrong-import-position,wrong-import-order
|
36 | 36 |
gi.require_version('OSTree', '1.0')
|
37 |
-from gi.repository import GLib, Gio, OSTree # nopep8
|
|
37 |
+from gi.repository import GLib, Gio, OSTree # noqa
|
|
38 | 38 |
|
39 | 39 |
|
40 | 40 |
# For users of this file, they must expect (except) it.
|
... | ... | @@ -38,7 +38,7 @@ def terminator_handler(signal_, frame): |
38 | 38 |
terminator_ = terminator_stack.pop()
|
39 | 39 |
try:
|
40 | 40 |
terminator_()
|
41 |
- except: # pylint: disable=bare-except
|
|
41 |
+ except: # noqa pylint: disable=bare-except
|
|
42 | 42 |
# Ensure we print something if there's an exception raised when
|
43 | 43 |
# processing the handlers. Note that the default exception
|
44 | 44 |
# handler won't be called because we os._exit next, so we must
|
... | ... | @@ -1568,7 +1568,7 @@ class Element(Plugin): |
1568 | 1568 |
utils._force_rmtree(rootdir)
|
1569 | 1569 |
|
1570 | 1570 |
with _signals.terminator(cleanup_rootdir), \
|
1571 |
- self.__sandbox(rootdir, output_file, output_file, self.__sandbox_config) as sandbox: # nopep8
|
|
1571 |
+ self.__sandbox(rootdir, output_file, output_file, self.__sandbox_config) as sandbox: # noqa
|
|
1572 | 1572 |
|
1573 | 1573 |
# By default, the dynamic public data is the same as the static public data.
|
1574 | 1574 |
# The plugin's assemble() method may modify this, though.
|
... | ... | @@ -105,6 +105,12 @@ class CoreWarnings(): |
105 | 105 |
is referenced either on the command line or by another element
|
106 | 106 |
"""
|
107 | 107 |
|
108 |
+ BAD_CHARACTERS_IN_NAME = "bad-characters-in-name"
|
|
109 |
+ """
|
|
110 |
+ This warning will be produces when filename for a target contains invalid
|
|
111 |
+ characters in its name.
|
|
112 |
+ """
|
|
113 |
+ |
|
108 | 114 |
|
109 | 115 |
# _KeyStrength():
|
110 | 116 |
#
|
... | ... | @@ -6,10 +6,10 @@ |
6 | 6 |
# we dont use the standard `sphinx-build` and `sphinx-apidoc` entry points.
|
7 | 7 |
#
|
8 | 8 |
# The following technique works as long as sphinx is installed for python3,
|
9 |
-# regardless of the entry point which might be in /usr/bin or PATH, but
|
|
10 |
-# will stop working in sphinx >= 2.0. Hopefully by then, the mentioned
|
|
11 |
-# bug will be fixed and we can use a standard python3 specific script to
|
|
12 |
-# invoke sphnix.
|
|
9 |
+# regardless of the entry point which might be in /usr/bin or PATH.
|
|
10 |
+#
|
|
11 |
+# Since Sphinx 2.0 is planned to be Python 3-only, this workaround should not
|
|
12 |
+# be needed once Spinx 2.0 is released, and we upgrade to it
|
|
13 | 13 |
#
|
14 | 14 |
SPHINXOPTS =
|
15 | 15 |
SPHINXBUILD = python3 -m sphinx
|
... | ... | @@ -526,3 +526,27 @@ read-only variables are also dynamically declared by BuildStream: |
526 | 526 |
build, support for this is conditional on the element type
|
527 | 527 |
and the build system used (any element using 'make' can
|
528 | 528 |
implement this).
|
529 |
+ |
|
530 |
+ |
|
531 |
+Naming elements
|
|
532 |
+---------------
|
|
533 |
+When naming the element files, use the following rules:
|
|
534 |
+ |
|
535 |
+* The name of the file must have ``.bst`` extension.
|
|
536 |
+ |
|
537 |
+* All characters in the name must be printable 7-bit ASCII characters.
|
|
538 |
+ |
|
539 |
+* Following characters are reserved and must not be part of the name:
|
|
540 |
+ |
|
541 |
+ - ``<`` (less than)
|
|
542 |
+ - ``>`` (greater than)
|
|
543 |
+ - ``:`` (colon)
|
|
544 |
+ - ``"`` (double quote)
|
|
545 |
+ - ``/`` (forward slash)
|
|
546 |
+ - ``\`` (backslash)
|
|
547 |
+ - ``|`` (vertical bar)
|
|
548 |
+ - ``?`` (question mark)
|
|
549 |
+ - ``*`` (asterisk)
|
|
550 |
+ |
|
551 |
+BuildStream will attempt to raise warnings when any of these rules are violated
|
|
552 |
+but that may not always be possible.
|
... | ... | @@ -11,20 +11,11 @@ parentdir_prefix = BuildStream- |
11 | 11 |
test=pytest
|
12 | 12 |
|
13 | 13 |
[tool:pytest]
|
14 |
-addopts = --verbose --basetemp ./tmp --pep8 --pylint --pylint-rcfile=.pylintrc --cov=buildstream --cov-config .coveragerc --durations=20
|
|
14 |
+addopts = --verbose --basetemp ./tmp --codestyle --pylint --pylint-rcfile=.pylintrc --cov=buildstream --cov-config .coveragerc --durations=20
|
|
15 | 15 |
norecursedirs = tests/integration/project integration-cache tmp __pycache__ .eggs
|
16 | 16 |
python_files = tests/*/*.py
|
17 |
-pep8maxlinelength = 119
|
|
18 |
-pep8ignore =
|
|
19 |
- * E129
|
|
20 |
- * E125
|
|
21 |
- doc/source/conf.py ALL
|
|
22 |
- tmp/* ALL
|
|
23 |
- */lib/python3* ALL
|
|
24 |
- */bin/* ALL
|
|
25 |
- buildstream/_fuse/fuse.py ALL
|
|
26 |
- .eggs/* ALL
|
|
27 |
- *_pb2.py ALL
|
|
28 |
- *_pb2_grpc.py ALL
|
|
17 |
+codestyle_max_line_length = 119
|
|
18 |
+codestyle_ignore = E129 E125 W504 W605
|
|
19 |
+codestyle_exclude = doc/source/conf.py buildstream/_fuse/fuse.py buildstream/_protos/**/*py
|
|
29 | 20 |
env =
|
30 | 21 |
D:BST_TEST_SUITE=True
|
... | ... | @@ -270,9 +270,12 @@ def get_cmdclass(): |
270 | 270 |
#####################################################
|
271 | 271 |
# Gather requirements #
|
272 | 272 |
#####################################################
|
273 |
-with open('dev-requirements.txt') as dev_reqs:
|
|
273 |
+with open('tools/dev-requirements.in') as dev_reqs:
|
|
274 | 274 |
dev_requires = dev_reqs.read().splitlines()
|
275 | 275 |
|
276 |
+with open('tools/requirements.in') as install_reqs:
|
|
277 |
+ install_requires = install_reqs.read().splitlines()
|
|
278 |
+ |
|
276 | 279 |
#####################################################
|
277 | 280 |
# Prepare package description from README #
|
278 | 281 |
#####################################################
|
... | ... | @@ -334,23 +337,7 @@ setup(name='BuildStream', |
334 | 337 |
os.path.join('buildstream', 'data', 'bst')
|
335 | 338 |
])
|
336 | 339 |
],
|
337 |
- install_requires=[
|
|
338 |
- 'setuptools',
|
|
339 |
- 'psutil',
|
|
340 |
- # According to ruamel.yaml's PyPI page, we are suppose to use
|
|
341 |
- # "<=0.15" in production until 0.15 becomes API stable.
|
|
342 |
- # However we need ruamel.yaml 0.15.41 or greater for Python 3.7.
|
|
343 |
- # We know that ruamel.yaml 0.15.52 breaks API in a way that
|
|
344 |
- # is incompatible with BuildStream.
|
|
345 |
- #
|
|
346 |
- # See issues #571 and #790.
|
|
347 |
- 'ruamel.yaml >= 0.15.41, < 0.15.52',
|
|
348 |
- 'pluginbase',
|
|
349 |
- 'Click >= 7.0',
|
|
350 |
- 'jinja2 >= 2.10',
|
|
351 |
- 'protobuf >= 3.5',
|
|
352 |
- 'grpcio >= 1.10',
|
|
353 |
- ],
|
|
340 |
+ install_requires=install_requires,
|
|
354 | 341 |
entry_points=bst_install_entry_points,
|
355 | 342 |
tests_require=dev_requires,
|
356 | 343 |
zip_safe=False)
|
... | ... | @@ -85,6 +85,20 @@ def test_build_invalid_suffix_dep(datafiles, cli, strict, hardlinks): |
85 | 85 |
result.assert_main_error(ErrorDomain.LOAD, "bad-element-suffix")
|
86 | 86 |
|
87 | 87 |
|
88 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
89 |
+def test_build_invalid_filename_chars(datafiles, cli):
|
|
90 |
+ project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
91 |
+ result = cli.run(project=project, args=strict_args(['build', 'invalid-chars|<>-in-name.bst'], 'non-strict'))
|
|
92 |
+ result.assert_main_error(ErrorDomain.LOAD, "bad-characters-in-name")
|
|
93 |
+ |
|
94 |
+ |
|
95 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
96 |
+def test_build_invalid_filename_chars_dep(datafiles, cli):
|
|
97 |
+ project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
98 |
+ result = cli.run(project=project, args=strict_args(['build', 'invalid-chars-in-dep.bst'], 'non-strict'))
|
|
99 |
+ result.assert_main_error(ErrorDomain.LOAD, "bad-characters-in-name")
|
|
100 |
+ |
|
101 |
+ |
|
88 | 102 |
@pytest.mark.datafiles(DATA_DIR)
|
89 | 103 |
@pytest.mark.parametrize("deps", [("run"), ("none"), ("build")])
|
90 | 104 |
def test_build_checkout_deps(datafiles, cli, deps):
|
1 |
+kind: stack
|
|
2 |
+description: |
|
|
3 |
+ |
|
4 |
+ This element itself has a valid name, but depends on elements that have
|
|
5 |
+ invalid names. This should also result in a warning.
|
|
6 |
+ |
|
7 |
+depends:
|
|
8 |
+- invalid-chars|<>-in-name.bst
|
1 |
+kind: stack
|
|
2 |
+description: |
|
|
3 |
+ The name of this files contains characters that are not allowed by
|
|
4 |
+ BuildStream, using it should raise a warning.
|
... | ... | @@ -5,3 +5,4 @@ element-path: elements |
5 | 5 |
|
6 | 6 |
fatal-warnings:
|
7 | 7 |
- bad-element-suffix
|
8 |
+- bad-characters-in-name
|
... | ... | @@ -3,7 +3,7 @@ import pytest |
3 | 3 |
import shutil
|
4 | 4 |
|
5 | 5 |
from buildstream import _yaml, ElementError
|
6 |
-from buildstream._exceptions import LoadError, LoadErrorReason
|
|
6 |
+from buildstream._exceptions import ErrorDomain, LoadErrorReason
|
|
7 | 7 |
from tests.testutils import cli, create_repo
|
8 | 8 |
from tests.testutils.site import HAVE_GIT
|
9 | 9 |
|
... | ... | @@ -38,9 +38,9 @@ def test_simple_build(cli, tmpdir, datafiles): |
38 | 38 |
|
39 | 39 |
# Build, checkout
|
40 | 40 |
result = cli.run(project=project, args=['build', 'target.bst'])
|
41 |
- assert result.exit_code == 0
|
|
41 |
+ result.assert_success()
|
|
42 | 42 |
result = cli.run(project=project, args=['checkout', 'target.bst', checkoutdir])
|
43 |
- assert result.exit_code == 0
|
|
43 |
+ result.assert_success()
|
|
44 | 44 |
|
45 | 45 |
# Check that the checkout contains the expected files from both projects
|
46 | 46 |
assert(os.path.exists(os.path.join(checkoutdir, 'base.txt')))
|
... | ... | @@ -54,7 +54,7 @@ def test_build_of_same_junction_used_twice(cli, tmpdir, datafiles): |
54 | 54 |
# Check we can build a project that contains the same junction
|
55 | 55 |
# that is used twice, but named differently
|
56 | 56 |
result = cli.run(project=project, args=['build', 'target.bst'])
|
57 |
- assert result.exit_code == 0
|
|
57 |
+ result.assert_success()
|
|
58 | 58 |
|
59 | 59 |
|
60 | 60 |
@pytest.mark.datafiles(DATA_DIR)
|
... | ... | @@ -69,9 +69,9 @@ def test_nested_simple(cli, tmpdir, datafiles): |
69 | 69 |
|
70 | 70 |
# Build, checkout
|
71 | 71 |
result = cli.run(project=project, args=['build', 'target.bst'])
|
72 |
- assert result.exit_code == 0
|
|
72 |
+ result.assert_success()
|
|
73 | 73 |
result = cli.run(project=project, args=['checkout', 'target.bst', checkoutdir])
|
74 |
- assert result.exit_code == 0
|
|
74 |
+ result.assert_success()
|
|
75 | 75 |
|
76 | 76 |
# Check that the checkout contains the expected files from all subprojects
|
77 | 77 |
assert(os.path.exists(os.path.join(checkoutdir, 'base.txt')))
|
... | ... | @@ -93,9 +93,9 @@ def test_nested_double(cli, tmpdir, datafiles): |
93 | 93 |
|
94 | 94 |
# Build, checkout
|
95 | 95 |
result = cli.run(project=project, args=['build', 'target.bst'])
|
96 |
- assert result.exit_code == 0
|
|
96 |
+ result.assert_success()
|
|
97 | 97 |
result = cli.run(project=project, args=['checkout', 'target.bst', checkoutdir])
|
98 |
- assert result.exit_code == 0
|
|
98 |
+ result.assert_success()
|
|
99 | 99 |
|
100 | 100 |
# Check that the checkout contains the expected files from all subprojects
|
101 | 101 |
assert(os.path.exists(os.path.join(checkoutdir, 'base.txt')))
|
... | ... | @@ -115,45 +115,46 @@ def test_nested_conflict(cli, datafiles): |
115 | 115 |
copy_subprojects(project, datafiles, ['foo', 'bar'])
|
116 | 116 |
|
117 | 117 |
result = cli.run(project=project, args=['build', 'target.bst'])
|
118 |
- assert result.exit_code != 0
|
|
119 |
- assert result.exception
|
|
120 |
- assert isinstance(result.exception, LoadError)
|
|
121 |
- assert result.exception.reason == LoadErrorReason.CONFLICTING_JUNCTION
|
|
118 |
+ result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.CONFLICTING_JUNCTION)
|
|
122 | 119 |
|
123 | 120 |
|
121 |
+# Test that we error correctly when the junction element itself is missing
|
|
124 | 122 |
@pytest.mark.datafiles(DATA_DIR)
|
125 |
-def test_invalid_missing(cli, datafiles):
|
|
123 |
+def test_missing_junction(cli, datafiles):
|
|
126 | 124 |
project = os.path.join(str(datafiles), 'invalid')
|
127 | 125 |
|
128 | 126 |
result = cli.run(project=project, args=['build', 'missing.bst'])
|
129 |
- assert result.exit_code != 0
|
|
130 |
- assert result.exception
|
|
131 |
- assert isinstance(result.exception, LoadError)
|
|
132 |
- assert result.exception.reason == LoadErrorReason.MISSING_FILE
|
|
127 |
+ result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE)
|
|
133 | 128 |
|
134 | 129 |
|
130 |
+# Test that we error correctly when an element is not found in the subproject
|
|
131 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
132 |
+def test_missing_subproject_element(cli, datafiles):
|
|
133 |
+ project = os.path.join(str(datafiles), 'invalid')
|
|
134 |
+ copy_subprojects(project, datafiles, ['base'])
|
|
135 |
+ |
|
136 |
+ result = cli.run(project=project, args=['build', 'missing-element.bst'])
|
|
137 |
+ result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE)
|
|
138 |
+ |
|
139 |
+ |
|
140 |
+# Test that we error correctly when a junction itself has dependencies
|
|
135 | 141 |
@pytest.mark.datafiles(DATA_DIR)
|
136 | 142 |
def test_invalid_with_deps(cli, datafiles):
|
137 | 143 |
project = os.path.join(str(datafiles), 'invalid')
|
138 | 144 |
copy_subprojects(project, datafiles, ['base'])
|
139 | 145 |
|
140 | 146 |
result = cli.run(project=project, args=['build', 'junction-with-deps.bst'])
|
141 |
- assert result.exit_code != 0
|
|
142 |
- assert result.exception
|
|
143 |
- assert isinstance(result.exception, ElementError)
|
|
144 |
- assert result.exception.reason == 'element-forbidden-depends'
|
|
147 |
+ result.assert_main_error(ErrorDomain.ELEMENT, 'element-forbidden-depends')
|
|
145 | 148 |
|
146 | 149 |
|
150 |
+# Test that we error correctly when a junction is directly depended on
|
|
147 | 151 |
@pytest.mark.datafiles(DATA_DIR)
|
148 | 152 |
def test_invalid_junction_dep(cli, datafiles):
|
149 | 153 |
project = os.path.join(str(datafiles), 'invalid')
|
150 | 154 |
copy_subprojects(project, datafiles, ['base'])
|
151 | 155 |
|
152 | 156 |
result = cli.run(project=project, args=['build', 'junction-dep.bst'])
|
153 |
- assert result.exit_code != 0
|
|
154 |
- assert result.exception
|
|
155 |
- assert isinstance(result.exception, LoadError)
|
|
156 |
- assert result.exception.reason == LoadErrorReason.INVALID_DATA
|
|
157 |
+ result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA)
|
|
157 | 158 |
|
158 | 159 |
|
159 | 160 |
@pytest.mark.datafiles(DATA_DIR)
|
... | ... | @@ -165,9 +166,9 @@ def test_options_default(cli, tmpdir, datafiles): |
165 | 166 |
|
166 | 167 |
# Build, checkout
|
167 | 168 |
result = cli.run(project=project, args=['build', 'target.bst'])
|
168 |
- assert result.exit_code == 0
|
|
169 |
+ result.assert_success()
|
|
169 | 170 |
result = cli.run(project=project, args=['checkout', 'target.bst', checkoutdir])
|
170 |
- assert result.exit_code == 0
|
|
171 |
+ result.assert_success()
|
|
171 | 172 |
|
172 | 173 |
assert(os.path.exists(os.path.join(checkoutdir, 'pony.txt')))
|
173 | 174 |
assert(not os.path.exists(os.path.join(checkoutdir, 'horsy.txt')))
|
... | ... | @@ -182,9 +183,9 @@ def test_options(cli, tmpdir, datafiles): |
182 | 183 |
|
183 | 184 |
# Build, checkout
|
184 | 185 |
result = cli.run(project=project, args=['build', 'target.bst'])
|
185 |
- assert result.exit_code == 0
|
|
186 |
+ result.assert_success()
|
|
186 | 187 |
result = cli.run(project=project, args=['checkout', 'target.bst', checkoutdir])
|
187 |
- assert result.exit_code == 0
|
|
188 |
+ result.assert_success()
|
|
188 | 189 |
|
189 | 190 |
assert(not os.path.exists(os.path.join(checkoutdir, 'pony.txt')))
|
190 | 191 |
assert(os.path.exists(os.path.join(checkoutdir, 'horsy.txt')))
|
... | ... | @@ -199,9 +200,9 @@ def test_options_inherit(cli, tmpdir, datafiles): |
199 | 200 |
|
200 | 201 |
# Build, checkout
|
201 | 202 |
result = cli.run(project=project, args=['build', 'target.bst'])
|
202 |
- assert result.exit_code == 0
|
|
203 |
+ result.assert_success()
|
|
203 | 204 |
result = cli.run(project=project, args=['checkout', 'target.bst', checkoutdir])
|
204 |
- assert result.exit_code == 0
|
|
205 |
+ result.assert_success()
|
|
205 | 206 |
|
206 | 207 |
assert(not os.path.exists(os.path.join(checkoutdir, 'pony.txt')))
|
207 | 208 |
assert(os.path.exists(os.path.join(checkoutdir, 'horsy.txt')))
|
... | ... | @@ -228,14 +229,11 @@ def test_git_show(cli, tmpdir, datafiles): |
228 | 229 |
|
229 | 230 |
# Verify that bst show does not implicitly fetch subproject
|
230 | 231 |
result = cli.run(project=project, args=['show', 'target.bst'])
|
231 |
- assert result.exit_code != 0
|
|
232 |
- assert result.exception
|
|
233 |
- assert isinstance(result.exception, LoadError)
|
|
234 |
- assert result.exception.reason == LoadErrorReason.SUBPROJECT_FETCH_NEEDED
|
|
232 |
+ result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.SUBPROJECT_FETCH_NEEDED)
|
|
235 | 233 |
|
236 | 234 |
# Explicitly fetch subproject
|
237 | 235 |
result = cli.run(project=project, args=['source', 'fetch', 'base.bst'])
|
238 |
- assert result.exit_code == 0
|
|
236 |
+ result.assert_success()
|
|
239 | 237 |
|
240 | 238 |
# Check that bst show succeeds now and the pipeline includes the subproject element
|
241 | 239 |
element_list = cli.get_pipeline(project, ['target.bst'])
|
... | ... | @@ -263,9 +261,9 @@ def test_git_build(cli, tmpdir, datafiles): |
263 | 261 |
|
264 | 262 |
# Build (with implicit fetch of subproject), checkout
|
265 | 263 |
result = cli.run(project=project, args=['build', 'target.bst'])
|
266 |
- assert result.exit_code == 0
|
|
264 |
+ result.assert_success()
|
|
267 | 265 |
result = cli.run(project=project, args=['checkout', 'target.bst', checkoutdir])
|
268 |
- assert result.exit_code == 0
|
|
266 |
+ result.assert_success()
|
|
269 | 267 |
|
270 | 268 |
# Check that the checkout contains the expected files from both projects
|
271 | 269 |
assert(os.path.exists(os.path.join(checkoutdir, 'base.txt')))
|
... | ... | @@ -304,9 +302,9 @@ def test_build_git_cross_junction_names(cli, tmpdir, datafiles): |
304 | 302 |
|
305 | 303 |
# Build (with implicit fetch of subproject), checkout
|
306 | 304 |
result = cli.run(project=project, args=['build', 'base.bst:target.bst'])
|
307 |
- assert result.exit_code == 0
|
|
305 |
+ result.assert_success()
|
|
308 | 306 |
result = cli.run(project=project, args=['checkout', 'base.bst:target.bst', checkoutdir])
|
309 |
- assert result.exit_code == 0
|
|
307 |
+ result.assert_success()
|
|
310 | 308 |
|
311 | 309 |
# Check that the checkout contains the expected files from both projects
|
312 | 310 |
assert(os.path.exists(os.path.join(checkoutdir, 'base.txt')))
|
1 |
+# This refers to the `foo.bst` element through
|
|
2 |
+# the `base.bst` junction. The `base.bst` junction
|
|
3 |
+# exists but the `foo.bst` element does not exist
|
|
4 |
+# in the subproject.
|
|
5 |
+#
|
|
6 |
+kind: stack
|
|
7 |
+depends:
|
|
8 |
+- junction: base.bst
|
|
9 |
+ filename: foo.bst
|
... | ... | @@ -29,7 +29,7 @@ class RequestHandler(SimpleHTTPRequestHandler): |
29 | 29 |
expected_password, directory = self.server.users[user]
|
30 | 30 |
if password == expected_password:
|
31 | 31 |
return directory
|
32 |
- except:
|
|
32 |
+ except: # noqa
|
|
33 | 33 |
raise Unauthorized('unauthorized')
|
34 | 34 |
return None
|
35 | 35 |
|
1 |
+coverage==4.4
|
|
2 |
+pep8==1.7.1
|
|
3 |
+pylint==2.2.2
|
|
4 |
+pytest==4.0.2
|
|
5 |
+pytest-cov==2.6.0
|
|
6 |
+pytest-datafiles==2.0
|
|
7 |
+pytest-env==0.6.2
|
|
8 |
+pytest-pep8==1.0.6
|
|
9 |
+pytest-pylint==0.13.0
|
|
10 |
+pytest-xdist==1.25.0
|
|
11 |
+pytest-timeout==1.3.3
|
|
12 |
+pyftpdlib==1.5.4
|
|
13 |
+## The following requirements were added by pip freeze:
|
|
14 |
+apipkg==1.5
|
|
15 |
+astroid==2.1.0
|
|
16 |
+atomicwrites==1.2.1
|
|
17 |
+attrs==18.2.0
|
|
18 |
+execnet==1.5.0
|
|
19 |
+isort==4.3.4
|
|
20 |
+lazy-object-proxy==1.3.1
|
|
21 |
+mccabe==0.6.1
|
|
22 |
+more-itertools==5.0.0
|
|
23 |
+pluggy==0.8.0
|
|
24 |
+py==1.7.0
|
|
25 |
+pytest-cache==1.0
|
|
26 |
+pytest-forked==0.2
|
|
27 |
+six==1.12.0
|
|
28 |
+typed-ast==1.1.1
|
|
29 |
+wrapt==1.10.11
|
1 |
+arpy
|
|
2 |
+PyGObject
|
1 |
+arpy==1.1.1
|
|
2 |
+PyGObject==3.30.4
|
|
3 |
+## The following requirements were added by pip freeze:
|
|
4 |
+pycairo==1.18.0
|
1 |
+Click
|
|
2 |
+grpcio >= 1.10
|
|
3 |
+jinja2 >= 2.10
|
|
4 |
+pluginbase
|
|
5 |
+protobuf >= 3.5
|
|
6 |
+psutil
|
|
7 |
+# According to ruamel.yaml's PyPI page, we are suppose to use
|
|
8 |
+# "<=0.15" in production until 0.15 becomes API stable.
|
|
9 |
+# However we need ruamel.yaml 0.15.41 or greater for Python 3.7.
|
|
10 |
+# We know that ruamel.yaml 0.15.52 breaks API in a way that
|
|
11 |
+# is incompatible with BuildStream.
|
|
12 |
+#
|
|
13 |
+# See issues #571 and #790.
|
|
14 |
+ruamel.yaml >= 0.15.41, < 0.15.52
|
|
15 |
+setuptools
|
1 |
+Click==7.0
|
|
2 |
+grpcio==1.17.1
|
|
3 |
+pluginbase==0.7
|
|
4 |
+protobuf==3.6.1
|
|
5 |
+psutil==5.4.8
|
|
6 |
+# According to ruamel.yaml's PyPI page, we are suppose to use
|
|
7 |
+# "<=0.15" in production until 0.15 becomes API stable.
|
|
8 |
+# However we need ruamel.yaml 0.15.41 or greater for Python 3.7.
|
|
9 |
+# We know that ruamel.yaml 0.15.52 breaks API in a way that
|
|
10 |
+# is incompatible with BuildStream.
|
|
11 |
+#
|
|
12 |
+# See issues #571 and #790.
|
|
13 |
+ruamel.yaml==0.15.51
|
|
14 |
+setuptools==39.0.1
|
|
15 |
+## The following requirements were added by pip freeze:
|
|
16 |
+Jinja2==2.10
|
|
17 |
+MarkupSafe==1.1.0
|
|
18 |
+six==1.12.0
|
1 |
+[tox]
|
|
2 |
+envlist = py35,py36,py37
|
|
3 |
+skip_missing_interpreters = true
|
|
4 |
+ |
|
5 |
+[testenv]
|
|
6 |
+commands = pytest {posargs}
|
|
7 |
+deps =
|
|
8 |
+ -rtools/requirements.txt
|
|
9 |
+ -rtools/dev-requirements.txt
|
|
10 |
+ -rtools/plugin-requirements.txt
|
|
11 |
+passenv =
|
|
12 |
+ BST_FORCE_BACKEND
|
|
13 |
+ GI_TYPELIB_PATH
|
|
14 |
+ |
|
15 |
+[testenv:docs]
|
|
16 |
+commands =
|
|
17 |
+ make -C doc
|
|
18 |
+# Currently sphinx_rtd_theme does not support Sphinx >1.8, this breaks search functionality
|
|
19 |
+deps =
|
|
20 |
+ sphinx==1.7.9
|
|
21 |
+ sphinx-click
|
|
22 |
+ sphinx_rtd_theme
|
|
23 |
+ -rtools/requirements.txt
|
|
24 |
+ -rtools/plugin-requirements.txt
|
|
25 |
+passenv =
|
|
26 |
+ BST_FORCE_SESSION_REBUILD
|
|
27 |
+ BST_SOURCE_CACHE
|
|
28 |
+ HOME
|
|
29 |
+ LANG
|
|
30 |
+ LC_ALL
|
|
31 |
+whitelist_externals =
|
|
32 |
+ make
|
|
33 |
+ |
|
34 |
+[testenv:test]
|
|
35 |
+deps = requests
|
|
36 |
+commands =
|
|
37 |
+ python3 -c 'import os; print(os.environ.get("HOME"))'
|