summaryrefslogtreecommitdiff
path: root/tests/frontend/fetch.py
Commit message (Collapse)AuthorAgeFilesLines
* tests/frontend: Refactor tests for default targetsChandan Singh2019-11-271-29/+0
| | | | | | | | | | | | | | | `tests/frontend/buildcheckout.py` is already very crowded with all sorts of tests. Since this test is not really about testing `bst build` but rather about testing whether BuildStream can detect the default targets correctly, move it to a separate test module. At the same time, also improve the actual tests. Currently the test compares the number of sub-directories in BuildStream log directory with the number of elements. Change it such that we directly query BuildStream about what's been built rather than trying to guess. While doing so, sanitize its project directory to make it clearer what's being tested.
* Fix stacktraces during element loadingTristan Maat2019-11-221-9/+1
| | | | | | | | | | These were caused by unhandled errors from plugins when calling `Source.get_consistency()`. This doesn't really solve the problem, since that interface is still used un-wrapped elsewhere, but it enables removing `Element.__schedule_tracking()` and fixes a bug. Ultimately we'd like to remove `Source.get_consistency()`, so this isn't too long-term of a problem.
* Reformat code using BlackChandan Singh2019-11-141-79/+37
| | | | | | | As discussed over the mailing list, reformat code using Black. This is a one-off change to reformat all our codebase. Moving forward, we shouldn't expect such blanket reformats. Rather, we expect each change to already comply with the Black formatting style.
* _yaml: Remove 'node_get_provenance' and add 'Node.get_provenance'Benjamin Schubert2019-07-151-1/+1
| | | | | | | | This replaces the helper method by adding a 'get_provenance' on the node directly - Adapt all call sites - Delay getting provenance wherever possible without major refactor
* tests: Change all calls to _yaml.dump to _yaml.rountrip_dumpBenjamin Schubert2019-07-151-6/+5
| | | | | Now that both are equivalent, we can skip the sanitization part before the yaml call.
* tests: remove 'node_get_yaml_provenance()' helper and replace with the new APIBenjamin Schubert2019-07-151-3/+4
| | | | | | This function is hard to make generic and, with the new API, the access is simplified. Therefore, removing this function and migrating all its usages
* tests: Fix import order of buildstream and tests modulesChandan Singh2019-05-211-1/+2
| | | | | | | | Now that the `buildstream` module is inside `src` directory, `pylint` treats `buildstream` as a third party module inside `tests`. As such, it wants the imports from `buildstream` to be placed before imports from `tests`. Adopt this style to fix the lint errors, which is probably also good for readability.
* test/frontend/fetch.py: Test for crashes when loading junctions in ↵tristan/fix-no-strict-junctionsTristan Van Berkom2019-05-081-1/+9
| | | | | | non-strict mode This is a regression test for #1018
* plugintestutils: Rename 'plugintestutils' package to 'testing'phil/rename-plugintestutilsPhil Dawson2019-04-161-2/+2
| | | | | | | | | - Rename plugintestutils to testing. - Don't run the tests from bst-plugins-template. This imports buildstream.plugintestutils so will have to be disabled to get through CI. This can be re nabled once bst-plugins-template has been patched.
* testutils: move repo.py into buildstream.plugintestutilsPhil Dawson2019-04-121-2/+2
| | | | | | | | This needs to be exposed as part of the plugin author facing API so that plugin authors can define custom repo types which will can be passed to the set of tests which iterate over multiple source types. Part of the work towards #944
* tests: ensure provenance for _get_loader errorsAngelos Evripiotis2019-03-261-1/+6
| | | | | | | | | | | | Make the tests that currently cover _get_loader ensure that we are getting the expected provenance. Note that for some tests, we must use yaml_file_get_provenance, as the generated yaml is not stable across versions of ruamel. In later work we may replace all instances of provenance string tests with yaml_file_get_provenance, as it will be more robust to future changes.
* tests: str(datafiles) instead of a longer thingAngelos Evripiotis2019-03-211-5/+5
| | | | | | | | | | | | | | | | | | | Replace some popular copypasta. This important-looking invocation: os.path.join(datafiles.dirname, datafiles.basename) is equivalent to this shorter invocation: project = str(datafiles) It seems like it's very popular copypasta, replace it with the shorter one thus: # Use 'gsed' or 'sed' etc. as appropriate for your system. git config --global alias.sub '!f() { git grep --name-only --null "$1" | gxargs --null gsed --in-place --expression "s/$1/$2/g" ; }; f' git sub 'os.path.join(datafiles.dirname, datafiles.basename)' 'str(datafiles)'
* tests:lint: disable 'unused-import' checks on pytest fixturesBenjamin Schubert2019-03-201-1/+1
| | | | | Pylint can't know that pytest's fixtures are used in a file and therefore reports false positives. Silencing all those errors
* tests:lint: silence redefined-outer-name in files using fixturesBenjamin Schubert2019-03-201-0/+3
| | | | | Pylint doesn't play well with pytest fixtures, we therefore need to silence this error.
* tests:lint: fix all unused-import from pylintBenjamin Schubert2019-03-201-1/+1
| | | | | Removes all the ones thare were not needed Whitelist the ones that are actually needed for side effects
* tests: move templated source tests from fetch.py into separate filePhil Dawson2019-03-141-75/+0
| | | | | | | | Create tests/sources/basic_functionality.py for templated source tests and move the templated tests in tests/frontend/fetch.py into sources/generic/fetch.py This is part of the preparation work for #944
* tests: Remove unused parameters in functionsBenjamin Schubert2019-03-011-2/+2
| | | | | For parameters that are required as part of an API, prefix them by "_" to make it clear they are unused
* Expose basic api for testing external plugins.phil/plugin-testing-apiPhil Dawson2019-02-081-1/+3
| | | | | | | | | | | | | | | | | | We want external plugins to be able to make use of the core testing utils. This commit exposes the basic utilities which are currently in use in bst-external plugins. If necessary, more utilities could be exposed in the future. Moves the following files from tests/testutils/ to buildstream/plugintestingutils/: o runcli.py o integration.py As part of this, this commit makes the following changes to runcli.py and integration.py: o runcli.py: Fix linting errors o runcli.py: Add user facing documentation o Integration.py: Add user facing documentation
* tests/frontend/fetch.py: Add default target test for bst source fetchJürg Billeter2019-01-241-0/+35
|
* Introduce new "source" command groupChandan Singh2018-12-141-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Following the message thread https://mail.gnome.org/archives/buildstream-list/2018-November/msg00106.html, implement a new command group called `source`. Move existing `track`, `fetch`, and the recently added `source-checkout` commands under this group. For `track` and `fetch`, this is a BREAKING change, as the old commands have been marked as obsolete. Using them will result in an error message that refers people to use the new versions, like `bst source fetch` instead of old `bst fetch`. `source-checkout` will now become `source checkout` (the dash has turned into a space), and is not a breaking change as it was added in the current development cycle. Note that the functionality to hide commands from help output was added only recently in Click, so the minimum version of Click that we now require is 7.0. Summary of changes: * _frontend/cli.py: Add `source` command group, mark previous versions as obsolete and hide them from the help output. * _frontend/complete.py: Fix completion for hidden commands. * setup.py: Bump Click minimum version to 7.0. * tests: Update to cope with the new command names. Fixes #814.
* Move tests.frontend.generate_junction to test.testutilsValentin David2018-08-021-2/+2
|
* Interpret names as colon separated junction path in loader.Valentin David2018-06-081-0/+38
| | | | | | 'a.bst:b.bst' gets interpreted as 'b.bst' from junction 'a.bst'. Part of #359.
* Load and save junctioned source refs from/to junction.refsTristan Van Berkom2018-04-251-1/+1
| | | | | | | | | | | | o _projectrefs.py: Additional constructor option to choose the base name o _project.py: Load two ProjectRefs objects, one for the junctions o source.py: Load and save junctioned source refs with the appropriate ProjectRefs object o tests: Updated some tests to expect junctions to be stored in junction.refs This fixes issue #361
* tests/frontend/fetch.py: Added tests for automatically fetching the junctionsTristan Van Berkom2018-04-051-1/+87
| | | | | | | | | | o This tests that a Consistency.RESOLVED junction will automatically be fetched when `bst fetch` is run on a pipeline which refers to a junction. o Further, it tests that a Consistency.INCONSISTENT junction will bail out with the expected error message Again testing with both ref-storage modes
* tests/frontend/fetch.py: Test failure modes of Source.get_consistency()Tristan Van Berkom2018-03-211-4/+29
| | | | | | | | | | Added a test that handled errors are reported at load time as expected. Added another test that we get the expected exception. This needs to be fixed, test contains FIXME: comment explaining that we could be doing much better here. This should be fixed in the context of issue #197
* tests/frontend: Updating tests to use new error checksTristan Van Berkom2018-01-011-1/+1
| | | | | This also fixes #177 - the problem here was solved simply by passing the project directory to `cli.run(project=project...)`
* Restructuring tests using the Repo and CliTristan Van Berkom2017-09-041-4/+2
| | | | | | Make all the test batteries which run on all the source backends we have repo scaffoldings for discover the list of Repo implementations automatically.
* tests/frontend/fetch.py: Added tests for `bst fetch`Tristan Van Berkom2017-09-041-0/+50