148 Commits

Author SHA1 Message Date
Chris Peterson
f01234e8a5 update debian/copyright
- Correctly add ISC licenses to new files in ubuntutools/tests/*
  as specified in debian/copyright
- Add GPL-3 licenses and correct attribution for:
    - running-autopkgtests
    - ubuntutools/running_autopkgtests.py
2024-03-13 09:21:30 -07:00
Chris Peterson
43891eda88 depends: python3-launchpadlib-desktop
Replace the dependency on python3-launchpadlib with
python3-launchpadlib-desktop. This package is the same as python3-launchpadlib
except that it also includes python3-keyring, which is a requirement for
some of the desktop-centric code-paths. In the case, requestsync has a
path for logging in via a web browser which also requires python3-keyring
to be installed. This had caused a ModuleNotFoundError when
python3-launchpadlib dropped python3-keyring from Recommends to Suggests
(LP: #2049217).
2024-03-13 09:17:49 -07:00
Chris Peterson
a9eb902b83 running-autopkgtests: Changelog entry, ArgumentParser, refactor, tests
Created a new changelog entry to include addition of the running-autopkgtests
script. This includes a refactor of the original script resulting in a new
module in ubuntutools, test cases, and the addition an argument parser to
allow printing just the queued tests, just the running tests, or both
(default).
2024-02-14 15:19:43 -08:00
Steve Langasek
6e6e1f1e1a Excise all references to cdbs (including in test cases) 2023-05-30 10:00:17 -07:00
Benjamin Drung
21784052ba test: Fix deprecated return value for test case
```
ubuntutools/test/test_archive.py::LocalSourcePackageTestCase::test_pull
  /usr/lib/python3.11/unittest/case.py:678: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method LocalSourcePackageTestCase.test_pull of <ubuntutools.test.test_archive.LocalSourcePackageTestCase testMethod=test_pull>>)
    return self.run(*args, **kwds)
```

`test_pull` does not need to be run directly. Make it private.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-31 17:39:12 +01:00
Benjamin Drung
aa556af89d Use f-strings
pylint complains about C0209: Formatting a regular string which could be
a f-string (consider-using-f-string)

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-31 19:32:58 +01:00
Benjamin Drung
444b319c12 Implement refactorings found by pylint
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-31 16:58:24 +01:00
Benjamin Drung
4449cf2437 Fix warnings found by pylint
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-31 15:51:29 +01:00
Benjamin Drung
ab64467f33 Run pylint during package build again
Commit ae74f71a1e9d4be043162b19d23f2d44c964c771 removed the pylint unit
test saying that unit tests are not needed to just run flake8 or pylint.

Since pylint is useful, add it back, but this time call it directly and
not embed it into a unit test.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-31 00:05:15 +01:00
Benjamin Drung
b1bc7e1cdc Address pylint complaints
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-30 23:10:31 +01:00
Benjamin Drung
4e27045f49 style: Sort Python imports with isort
```
isort -l 99 --profile=black .
```

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-30 21:28:47 +01:00
Benjamin Drung
3354b526b5 style: Format Python code with black
```
PYTHON_SCRIPTS=$(grep -l -r '^#! */usr/bin/python3$' .)
black -C -l 99 . $PYTHON_SCRIPTS
```

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-30 19:45:36 +01:00
Dan Streetman
b4ca04efaa test: fix archive tests
Assumptions were made about the implementation by mocking
that are no longer true, and the tests generally need to be
fixed to be more robust about testing
2021-07-14 17:41:10 -04:00
Dan Streetman
0eaf71737d test: fix example package class
this class can be much simpler and more robust and doesn't require
checking in the example package files to git
2021-07-14 17:41:10 -04:00
Dan Streetman
52739e44ad test: simplify test_help with subtests
Signed-off-by: Dan Streetman <ddstreet@canonical.com>
2021-02-02 06:25:12 -05:00
Dan Streetman
12c2e6bf42 test: remove unneeded stuff in test/__init__.py
Signed-off-by: Dan Streetman <ddstreet@canonical.com>
2021-02-02 06:25:12 -05:00
Dan Streetman
ae74f71a1e test: remove flake8 and pylint unittest files
unit tests aren't needed just to run flake8 or pylint.

Signed-off-by: Dan Streetman <ddstreet@canonical.com>
2021-02-02 06:25:12 -05:00
Dan Streetman
48c7130008 test: remove dep on mock, use unittest.mock instead
Signed-off-by: Dan Streetman <ddstreet@canonical.com>
2021-02-02 06:25:12 -05:00
Dan Streetman
fe4d2f08a5 test: remove test_dsc_missing test
This test class performs 'local source package' tests, but a missing
local dsc file won't perform any local test, it will query the LP server.
The test attempted to narrowly mock out specific network access to
emulate a 'missing' package by trying to return 404 when the url from
SourcePackage._lp_url() is opened, but now that _lp_url() is removed,
a missing local dsc file will result in full querying of the LP api,
which is not as easily mocked.
2020-03-06 13:01:37 +01:00
Dan Streetman
1a30454d1e test: remove test_archive obsolete tests
some tests mocked into the implementation of archive.py, which has now
changed dramatically, and the tests are no longer valid.
2019-11-25 10:10:06 -05:00
Dan Streetman
90e8fe81e1 replace ubuntutools.logger with standard python logging 2019-11-25 10:10:06 -05:00
Dan Streetman
3a413760f3 ubuntutools: add pull-* --no-verify-signature option, don't fail if no pub key
Change dsc verification to fail only if the public key was available, but
signature verification failed.  If no public key is available for the dsc,
print warning only. (LP: #1700846)

Also add pull-* parameter --no-verify-signature to manually prevent failure
when signature verification fails.
2019-11-25 10:10:06 -05:00
Dan Streetman
b96885f05e ubuntutools/archive: convert external rmadison call to native implementation
instead of a function that calls the system program rmadison, use
a fully-functional class to interface with the madison api, as well
as the debian snapshot api
2019-11-25 09:57:54 -05:00
Dan Streetman
b0c22e1d57 pull-pkg: update archive.py SourcePackage
verify it can parse/load DSC when created
throw PackageNotFoundException from lp_spph if can't find package
update test case expected order of url processing
2019-11-25 09:57:54 -05:00
Dan Streetman
0931098a2c tests/pylint.conf: use jobs=0 to speed up tests 2019-11-07 15:03:29 -05:00
Mattia Rizzolo
434ca8952e
Merge branch 'python3' of git+ssh://git.launchpad.net/ubuntu-dev-tools
MR: https://code.launchpad.net/~ubuntu-dev/ubuntu-dev-tools/+git/ubuntu-dev-tools/+merge/372305
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
2019-09-10 14:19:07 +02:00
Dan Streetman
a7d166b52f pull-pkg: use ubuntutools/version/Version
instead of debian.debian_support.Version, use ubuntutools version,
which extends it and adds the strip_epoch() function which is
needed to convert full version string to version used in filenames
2019-09-09 12:25:21 -04:00
Stefano Rivera
7b2f1a713b Remove more Python 2 fallback imports 2019-09-05 09:49:41 -03:00
Stefano Rivera
301569e809 Pull out Python 2 support hacks 2019-09-04 19:24:44 -03:00
Stefano Rivera
bb765237db Port Python scripts to Python 3, remove python 2 modules. (Closes: #938740, LP: #1099537) 2019-09-04 19:24:44 -03:00
Stefano Rivera
a41af75643 Close FDs after tests 2019-09-04 19:24:44 -03:00
Stefano Rivera
2d3765522e Use the Popen() encoding flag to decode to unicode
This should make behavior identical on Python 2 & 3.
2019-09-04 19:24:44 -03:00
Stefano Rivera
5769a70d02 Increase --help timeout, seeing a few of them 2019-09-03 21:16:59 -03:00
Stefano Rivera
e163ee0158 Test with the pylint command, we don't have py2+3 versions any more 2019-09-03 21:10:38 -03:00
Mattia Rizzolo
3fb7516d72
Default to checking signatures while pulling a .dsc.
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
2019-08-05 13:50:33 +02:00
Benjamin Drung
74df5b3869 Update pylint and flake8 unittests
Import improvements from https://github.com/bdrung/snippets
2018-10-06 17:42:59 +02:00
Benjamin Drung
468dbc7746 ubuntutools/test: Introduce get_source_files function
The flake8 and pylint unittest use the same logic to determine the source
files. Therefore put this logic in one function.
2018-10-06 17:16:12 +02:00
Mattia Rizzolo
607f5a712f
Fix FTBFS due to newest tar being picker about arguments order
Closes: #897478
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
2018-05-10 10:38:25 +02:00
Mattia Rizzolo
edb49c652c
Fix test failures with newer flake8 and pylint.
Closes: #891721
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
2018-03-08 12:56:36 +01:00
Iain Lane
0a3738cfbc Fix some 2/3 differences and run pylint with confidence=HIGH
Too many false positives otherwise.
2017-05-30 11:22:49 +01:00
Iain Lane
179f45ca9c Add some more ignores for pylint
It doesn't work very well with apt_pkg.
2017-05-30 10:27:22 +01:00
Benjamin Drung
18ae4d8a39 Add flake8 check to test suite 2017-05-01 00:20:17 +02:00
Benjamin Drung
cc7170eccb Fix all flake8 issues 2017-05-01 00:20:03 +02:00
Benjamin Drung
67c353d91b Raise maximum line length to 99 2017-04-30 22:31:09 +02:00
Benjamin Drung
ba16daf56f Repair pylint test case
The --include-ids parameter was dropped from pylint and thus the command
failed as was skipped. Repair the pylint check and add support for
Python 3.
2017-04-30 22:29:41 +02:00
Dimitri John Ledkov
99eb51b4e1 Fix test_config to skip Unicode environment variable test, when python
interpreter is not running in an unicode capable locale.
2015-01-19 15:21:00 +00:00
Dimitri John Ledkov
8ae64c16e2 Disable test_dsc_badsig, when no networking is available. 2014-12-18 23:35:00 +00:00
Dimitri John Ledkov
866adfd768 Actually, now that more things expect streaming bytes over the wire
the mirror tests don't stall anymore. Also use a codec.reader to slurp
up unicode bytes for json.load.
2014-12-18 23:18:00 +00:00
Dimitri John Ledkov
5da114b070 More consistent binary handling throughout.
Don't mock open(..., "b") with str / StringIO.
Silence source package pull, buffered/mocked output does not flush.
Disable mirror tests on python3, stall/hang.
2014-12-18 23:03:23 +00:00
Dimitri John Ledkov
412afabc1c Fix maintainer 2014-12-18 21:54:52 +00:00