summaryrefslogtreecommitdiff
path: root/tests/sources/tar.py
Commit message (Collapse)AuthorAgeFilesLines
* tests/sources/tar.py: Fix flaky test_out_of_basedir_hardlinksjuerg/tar-hardlinksJürg Billeter2020-04-201-1/+6
| | | | | | Don't recursively add `contents` to the tar file as the order is not guaranteed. We need to add `elsewhere` before `to_extract` as the latter references the former in `linkname`.
* testing: Add functions to generate yaml filesThomas Coldrick2020-01-241-29/+19
| | | | | | | Adds functions to the `buildstream.testing` package to allow plugins to dump elements and projects on the fly. Before this plugins were just accessing the private yaml API for tests and loading/dumping directly. I also allow access to just `_yaml.load()` from testing.
* exceptions: Expose ErrorDomain, ErrorLoadReasonThomas Coldrick2020-01-231-1/+1
| | | | | | | Plugin tests are already accessing this API, but using imports from private modules. For motivation for this to be exposed publicly, note that ErrorDomain is an argument for most things in runcli.py, and LoadErrorReason may be another.
* tests/sources/tar.py: Use `utils._force_rmtree` instead of chmodTristan Maat2019-12-101-11/+3
| | | | | | | | | While this is deep in our test suite, and should therefore never create files that leak information, our code security linter complains about setting broad file permissions. We should really be using `utils._force_rmtree` here anyway, to stop duplicating code, so that's what we do.
* Reformat code using BlackChandan Singh2019-11-141-129/+107
| | | | | | | 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.
* tests/tar: Add test for unreadable and unwritable content tar sourceShahwat Dalal2019-09-051-3/+5
| | | | | This test was added to consider the edge case when a unreadable file is being added to CAS.
* tests: Change all calls to _yaml.dump to _yaml.rountrip_dumpBenjamin Schubert2019-07-151-3/+3
| | | | | Now that both are equivalent, we can skip the sanitization part before the yaml call.
* utils.py: Add write permission to root path in _force_rmtreeshashwatdalal/tar-file-extractionShahwat Dalal2019-07-041-4/+21
| | | | | This is needed in the case where the temp directory permissions are changed between creation and deletion.
* tar.py: Make link target renaming work between base-dirsTristan Maat2019-07-021-0/+83
| | | | Fixes #1052
* test:utils/site: Consolidate Lzip environment variables in a single placeBenjamin Schubert2019-06-061-1/+1
| | | | | | | We have two different 'site' files that are redundant and both define some variables in BuildStream environment. Moving all the lzip related ones in a single place.
* plugintestutils: Rename 'plugintestutils' package to 'testing'phil/rename-plugintestutilsPhil Dawson2019-04-161-1/+1
| | | | | | | | | - 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.
* tests: str(datafiles) instead of a longer thingAngelos Evripiotis2019-03-211-11/+11
| | | | | | | | | | | | | | | | | | | 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: remove all unneccessary-parens errors from pylintBenjamin Schubert2019-03-201-6/+6
|
* tests:lint: reorder imports for consistencyBenjamin Schubert2019-03-201-3/+4
| | | | | - Remove all wrong-import-order from pylint - Order some subgroups of imports
* tests: Remove unused parameters in functionsBenjamin Schubert2019-03-011-1/+1
| | | | | For parameters that are required as part of an API, prefix them by "_" to make it clear they are unused
* tests: Remove unused variablesBenjamin Schubert2019-03-011-1/+0
|
* Use [a, b, *c] instead of [a, b] + c when building listbschubert/more-pythonic-list-concatBenjamin Schubert2019-03-011-1/+1
| | | | | This pattern is available from python3.5 and provides a simpler understanding of what is going on
* Expose basic api for testing external plugins.phil/plugin-testing-apiPhil Dawson2019-02-081-1/+1
| | | | | | | | | | | | | | | | | | 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
* Mark 'old' checkout command as obsoleteJames Ennis2019-01-221-6/+6
| | | | | | | | | | | This commit marks 'bst checkout' as a 'hidden' command. If used, the user will be prompted to use the new 'bst artifact checkout' command. All tests which used 'bst checkout' have been modified to use the new artifact sub-command. This partially solves #822.
* tests/sources/tar.py: Test that we don't crash when HOME is unsetTristan Van Berkom2018-12-261-0/+16
| | | | | This happens when the netrc module is searching for a ~/.netrc file and it doesnt find any HOME set.
* Introduce new "source" command groupChandan Singh2018-12-141-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add support for .netrc in remote/tar/zip pluginsValentin David2018-11-291-0/+86
| | | | Fixes #723.
* tests: Modify tests to ensure retry FAILUREJosh Smith2018-08-311-1/+1
|
* tar.py: Add test for a tarball containing a read-only dirjmac/tempfile-extraction-bugJames Ennis2018-08-241-0/+45
|
* tests/sources: deb, tar and zip all test for retry behaviourJosh Smith2018-07-271-1/+2
| | | | | | This is following 5d6418a06a3a0262df5f6b9e6e1a36578515fd4a where DownloadableFileSource was modified to raise 'temporary' errors when relating to file downloading.
* Move _list_dir_contents to __init__.pyMove-_list_dir_contents-to-__init__425-add-a-deps-flag-to-bst-checkoutPhillip Smyth2018-07-111-20/+11
|
* _stream.py: Add StreamError exceptionTristan Van Berkom2018-05-081-2/+2
| | | | Use Stream error for Stream errors.
* tests/sources: Use new error checking tools for source testsTristan Van Berkom2018-01-011-28/+26
| | | | | | Also added a test case for the `patch` plugin which checks for graceful failure when the specified patch file is not a regular file (but a block device or a named pipe instead).
* Adapting test cases to expect logs in stderrTristan Van Berkom2017-12-131-1/+1
| | | | And also adapted them to remove any occurrences of HAVE_ROOT.
* Remove unused imports in test filesGökçen Nurlu2017-12-071-1/+1
|
* Add a test for tar lzipValentin David2017-11-301-0/+46
|
* tests/sources/tar.py: Test for tarballs containing linksTristan Van Berkom2017-11-171-0/+36
| | | | This reproduces issue #155
* tests/sources/tar.py: Converted tar test to use the CLI and enhancedTristan Van Berkom2017-11-031-98/+122
| | | | | | Now test to also ensure that base-dir expressions always behave the same way regardless of whether the tarball was created with a leading '.' or not.
* tar.py source test case: Stop using tar's private _sha256sum() methodTristan Van Berkom2017-09-121-4/+5
| | | | | That was removed anyway, now use utils.sha256sum() to calculate the expected tar ref.
* Added/fixed tar source tests.Tristan Van Berkom2017-05-141-2/+24
| | | | | | | | | Fixed original staging test to expect the content of the first encountered subdirectory to be extracted/staged. Added additional test to override the base-dir configuration with an empty string and instead extract the root of the tarball directly.
* Add tests for the tar sourceJonathan Maw2017-04-131-0/+140