Merge ppa-dev-tools:set-command-dependencies into ppa-dev-tools:main

Proposed by Bryce Harrington
Status: Merged
Merge reported by: Bryce Harrington
Merged at revision: 731e1db3e6065a5951108673437b588e689e14e8
Proposed branch: ppa-dev-tools:set-command-dependencies
Merge into: ppa-dev-tools:main
Diff against target: 472 lines (+197/-32)
5 files modified
ppa/lp.py (+10/-2)
ppa/ppa.py (+122/-4)
scripts/ppa (+36/-18)
tests/helpers.py (+5/-0)
tests/test_scripts_ppa.py (+24/-8)
Reviewer Review Type Date Requested Status
Lena Voytek (community) Approve
Canonical Server packageset reviewers Pending
Canonical Server Reporter Pending
Review via email: mp+441265@code.launchpad.net

Description of the change

This adds support for the --ppa-dependencies option to the create and set commands, to permit adding one or more PPAs for satisfying the given PPA's build dependencies.

I've also added the start of a handy smoketest for the ppa/ppa.py module to run through the basic settings. I plan to expand this to exercise more of the module but for now just tried to establish the basic structure and operation. I've sorted out making it use the 'qastaging' test instance of Launchpad to be able to validate the launchpad operations without actually impacting anything in production. Note that the data from qastaging is quite old and in fact may be missing your user account if you registered within the last few years, so I hope it works but YMMV. If not, you can flip staging off by editing the smoketest thusly:

    lp = Lp('smoketest', staging=False)

There's also a few small cleanup/refactors in separate commits.

Anyway, as usual the smoketest can be run via:

    $ python3 -m ppa.ppa

And all testing run via `pytest-3` or:

    $ make check

To post a comment you must log in.
Revision history for this message
Bryce Harrington (bryce) wrote :

Example output for the smoke test:

$ python3 -m ppa.ppa
##########################
## Ppa class smoke test ##
##########################

setting desc to 'This is a testing PPA and can be deleted'
desc is now 'This is a testing PPA and can be deleted'

name: test-ppa-dxtefi
address: ppa:bryce/test-ppa-dxtefi
str(ppa): bryce/test-ppa-dxtefi
reference: ~bryce/ubuntu/test-ppa-dxtefi
self_link: https://api.qastaging.launchpad.net/devel/~bryce/+archive/ubuntu/test-ppa-dxtefi
web_link: https://qastaging.launchpad.net/~bryce/+archive/ubuntu/test-ppa-dxtefi
description: This is a testing PPA and can be deleted
has_packages: False
architectures: amd64/arm64
dependencies: ~bryce/ubuntu/dependency-ppa-dxtefi
url: https://qastaging.launchpad.net/~bryce/+archive/ubuntu/test-ppa-dxtefi

Ready to cleanup (i.e. delete) temporary PPAs? (y/n) y
...Cleaning up test ppa...

Revision history for this message
Lena Voytek (lvoytek) wrote :

Sorry for only getting to this today, got distracted on Friday. Code looks good to me! Added a few comments for cleanup

review: Approve
Revision history for this message
Bryce Harrington (bryce) wrote :

Thanks for the review! One comment below, the rest of the suggestions are incorporated, I'll squash and land the branch directly.

Revision history for this message
Bryce Harrington (bryce) wrote :

Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
To git+ssh://git.launchpad.net/ppa-dev-tools
   2e6b5d7..d71ef8d main -> main

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/ppa/lp.py b/ppa/lp.py
index 1762345..17b225a 100644
--- a/ppa/lp.py
+++ b/ppa/lp.py
@@ -39,16 +39,24 @@ class Lp:
3939
40 _real_instance = None40 _real_instance = None
4141
42 def __init__(self, application_name, service=Launchpad):42 def __init__(self, application_name, service=Launchpad, staging=False):
43 """Create a Launchpad service object."""43 """Create a Launchpad service object."""
44 self._app_name = application_name44 self._app_name = application_name
45 self._service = service45 self._service = service
46 if staging:
47 self._service_root = 'qastaging'
48 self.ROOT_URL = 'https://qastaging.launchpad.net/'
49 self.API_ROOT_URL = 'https://api.qastaging.launchpad.net/devel/'
50 self.BUGS_ROOT_URL = 'https://bugs.qastaging.launchpad.net/'
51 self.CODE_ROOT_URL = 'https://code.qastaging.launchpad.net/'
52 else:
53 self._service_root = 'production'
4654
47 def _get_instance(self):55 def _get_instance(self):
48 """Authenticate to Launchpad."""56 """Authenticate to Launchpad."""
49 return self._service.login_with(57 return self._service.login_with(
50 application_name=self._app_name,58 application_name=self._app_name,
51 service_root='production',59 service_root=self._service_root,
52 allow_access_levels=['WRITE_PRIVATE'],60 allow_access_levels=['WRITE_PRIVATE'],
53 version='devel', # Need devel for copyPackage.61 version='devel', # Need devel for copyPackage.
54 )62 )
diff --git a/ppa/ppa.py b/ppa/ppa.py
index 1536b7d..52894c4 100755
--- a/ppa/ppa.py
+++ b/ppa/ppa.py
@@ -14,7 +14,7 @@ import re
14import sys14import sys
1515
16from functools import lru_cache16from functools import lru_cache
17from lazr.restfulclient.errors import BadRequest, NotFound17from lazr.restfulclient.errors import BadRequest, NotFound, Unauthorized
1818
1919
20class PpaDoesNotExist(BaseException):20class PpaDoesNotExist(BaseException):
@@ -141,7 +141,7 @@ class Ppa:
141 :rtype: str141 :rtype: str
142 :returns: The url of the PPA.142 :returns: The url of the PPA.
143 """143 """
144 return "https://launchpad.net/~{}/+archive/ubuntu/{}".format(self.team_name, self.ppa_name)144 return self.archive.web_link
145145
146 @property146 @property
147 def description(self):147 def description(self):
@@ -209,8 +209,10 @@ class Ppa:
209 """209 """
210 if not architectures:210 if not architectures:
211 return False211 return False
212 uri_base = "https://api.launchpad.net/devel/+processors/{}"212 base = self._service.API_ROOT_URL.rstrip('/')
213 procs = [uri_base.format(arch) for arch in architectures]213 procs = []
214 for arch in architectures:
215 procs.append(f'{base}/+processors/{arch}')
214 try:216 try:
215 self.archive.setProcessors(processors=procs)217 self.archive.setProcessors(processors=procs)
216 return True218 return True
@@ -218,6 +220,55 @@ class Ppa:
218 sys.stderr.write(e)220 sys.stderr.write(e)
219 return False221 return False
220222
223 @property
224 @lru_cache
225 def dependencies(self) -> list[str]:
226 """Returns the additional PPAs configured for building packages in this PPA.
227
228 :rtype: list[str]
229 :returns: List of PPA addresses
230 """
231 ppa_addresses = []
232 for dep in self.archive.dependencies:
233 ppa_dep = dep.dependency
234 ppa_addresses.append(ppa_dep.reference)
235 return ppa_addresses
236
237 def set_dependencies(self, ppa_addresses: list[str]):
238 """Configures the additional PPAs used to build packages in this PPA.
239
240 This removes any existing PPA dependencies and adds the ones
241 in the corresponding list. If any of these new PPAs cannot be
242 found, this routine bails out without changing the current set.
243
244 :param list[str] ppa_addresses: Additional PPAs to add
245 """
246 base = self._service.API_ROOT_URL.rstrip('/')
247 new_ppa_deps = []
248 for ppa_address in ppa_addresses:
249 team_name, ppa_name = ppa_address_split(ppa_address)
250 new_ppa_dep = f'{base}/~{team_name}/+archive/ubuntu/{ppa_name}'
251 new_ppa_deps.append(new_ppa_dep)
252
253 # TODO: Remove all existing dependencies
254# for ppa_dep in self.archive.dependencies:
255# the_ppa.removeArchiveDependency(ppa_dep)
256
257 # TODO: Not sure what to pass here, maybe a string ala 'main'?
258 component = None
259
260 # TODO: Allow setting alternate pockets
261 # TODO: Maybe for convenience it should be same as what's set for main archive?
262 pocket = 'Release'
263
264 for ppa_dep in new_ppa_deps:
265 self.archive.addArchiveDependency(
266 component=component,
267 dependency=ppa_dep,
268 pocket=pocket)
269 # TODO: Error checking
270 # This can throw ArchiveDependencyError if the ppa_address does not fit the_ppa
271
221 def get_binaries(self, distro=None, series=None, arch=None):272 def get_binaries(self, distro=None, series=None, arch=None):
222 """Retrieves the binary packages available in the PPA.273 """Retrieves the binary packages available in the PPA.
223274
@@ -450,3 +501,70 @@ def get_ppa(lp, config):
450 ppa_name=config.get('ppa_name', None),501 ppa_name=config.get('ppa_name', None),
451 team_name=config.get('team_name', None),502 team_name=config.get('team_name', None),
452 service=lp)503 service=lp)
504
505
506if __name__ == "__main__":
507 import pprint
508 import random
509 import string
510 from .lp import Lp
511 from .ppa_group import PpaGroup
512
513 pp = pprint.PrettyPrinter(indent=4)
514
515 print('##########################')
516 print('## Ppa class smoke test ##')
517 print('##########################')
518 print()
519
520 rndstr = str(''.join(random.choices(string.ascii_lowercase, k=6)))
521 dep_name = f'dependency-ppa-{rndstr}'
522 smoketest_ppa_name = f'test-ppa-{rndstr}'
523
524 lp = Lp('smoketest', staging=True)
525 ppa_group = PpaGroup(service=lp, name=lp.me.name)
526
527 dep_ppa = ppa_group.create(dep_name, ppa_description=dep_name)
528 the_ppa = ppa_group.create(smoketest_ppa_name, ppa_description=smoketest_ppa_name)
529 ppa_dependencies = [f'ppa:{lp.me.name}/{dep_name}']
530
531 try:
532 the_ppa.set_publish(True)
533
534 if not the_ppa.exists():
535 print("Error: PPA does not exist")
536 sys.exit(1)
537 the_ppa.set_description("This is a testing PPA and can be deleted")
538 the_ppa.set_publish(False)
539 the_ppa.set_architectures(["amd64", "arm64"])
540 the_ppa.set_dependencies(ppa_dependencies)
541
542 print()
543 print(f"name: {the_ppa.name}")
544 print(f"address: {the_ppa.address}")
545 print(f"str(ppa): {the_ppa}")
546 print(f"reference: {the_ppa.archive.reference}")
547 print(f"self_link: {the_ppa.archive.self_link}")
548 print(f"web_link: {the_ppa.archive.web_link}")
549 print(f"description: {the_ppa.description}")
550 print(f"has_packages: {the_ppa.has_packages()}")
551 print(f"architectures: {'/'.join(the_ppa.architectures)}")
552 print(f"dependencies: {','.join(the_ppa.dependencies)}")
553 print(f"url: {the_ppa.url}")
554 print()
555
556 except BadRequest as e:
557 print(f"Error: (BadRequest) {str(e.content.decode('utf-8'))}")
558 except Unauthorized as e:
559 print(f"Error: (Unauthorized) {e}")
560
561 answer = 'x'
562 while answer not in ['y', 'n']:
563 answer = input('Ready to cleanup (i.e. delete) temporary test PPAs? (y/n) ')
564 answer = answer[0].lower()
565
566 if answer == 'y':
567 print(" Cleaning up temporary test PPAs...")
568 the_ppa.destroy()
569 dep_ppa.destroy()
570 print(" ...Done")
diff --git a/scripts/ppa b/scripts/ppa
index 9097004..29413ea 100755
--- a/scripts/ppa
+++ b/scripts/ppa
@@ -206,6 +206,13 @@ def add_basic_config_options(parser: argparse.ArgumentParser) -> None:
206 help="Do not accept or build packages uploaded to the PPA."206 help="Do not accept or build packages uploaded to the PPA."
207 )207 )
208208
209 # Dependencies
210 parser.add_argument(
211 '--ppa-dependencies', '--ppa-depends',
212 dest="ppa_dependencies", action='store',
213 help="The set of other PPAs this PPA should use for satisfying build dependencies."
214 )
215
209 parser.add_argument(216 parser.add_argument(
210 '--publish',217 '--publish',
211 dest="publish", action='store_true',218 dest="publish", action='store_true',
@@ -443,11 +450,11 @@ def create_config(lp: Lp, args: argparse.Namespace) -> dict[str, Any]:
443### Commands ###450### Commands ###
444################451################
445452
446def command_create(lp, config):453def command_create(lp: Lp, config: dict[str, str]) -> int:
447 """Creates a new PPA in Launchpad.454 """Creates a new PPA in Launchpad.
448455
449 :param Lp lp: The Launchpad wrapper object.456 :param Lp lp: The Launchpad wrapper object.
450 :param dict config: Configuration param:value map.457 :param dict[str, str] config: Configuration param:value map.
451 :rtype: int458 :rtype: int
452 :returns: Status code OK (0) on success, non-zero on error.459 :returns: Status code OK (0) on success, non-zero on error.
453 """460 """
@@ -480,6 +487,12 @@ def command_create(lp, config):
480 if architectures:487 if architectures:
481 the_ppa.set_architectures(architectures)488 the_ppa.set_architectures(architectures)
482 arch_str = ', '.join(the_ppa.architectures)489 arch_str = ', '.join(the_ppa.architectures)
490
491 if 'ppa_dependencies' in config:
492 # Split value on comma
493 ppa_addresses = unpack_to_dict(config.get('ppa_dependencies'))
494 the_ppa.set_dependencies(ppa_addresses)
495
483 else:496 else:
484 the_ppa = Ppa(ppa_name, team_name, description)497 the_ppa = Ppa(ppa_name, team_name, description)
485 arch_str = ', '.join(architectures)498 arch_str = ', '.join(architectures)
@@ -505,7 +518,7 @@ def command_create(lp, config):
505 return 1518 return 1
506519
507520
508def command_desc(lp, config):521def command_desc(lp: Lp, config: dict[str, str]) -> int:
509 """Sets the description for a PPA.522 """Sets the description for a PPA.
510523
511 :param dict config: Configuration param:value map.524 :param dict config: Configuration param:value map.
@@ -534,11 +547,11 @@ def command_desc(lp, config):
534 return 1547 return 1
535548
536549
537def command_destroy(lp, config):550def command_destroy(lp: Lp, config: dict[str, str]) -> int:
538 """Destroys the PPA.551 """Destroys the PPA.
539552
540 :param Lp lp: The Launchpad wrapper object.553 :param Lp lp: The Launchpad wrapper object.
541 :param dict config: Configuration param:value map.554 :param dict[str, str] config: Configuration param:value map.
542 :rtype: int555 :rtype: int
543 :returns: Status code OK (0) on success, non-zero on error.556 :returns: Status code OK (0) on success, non-zero on error.
544 """557 """
@@ -554,11 +567,11 @@ def command_destroy(lp, config):
554 return 1567 return 1
555568
556569
557def command_list(lp, config, filter_func=None):570def command_list(lp: Lp, config: dict[str, str], filter_func=None) -> int:
558 """Lists the PPAs for the user or team.571 """Lists the PPAs for the user or team.
559572
560 :param Lp lp: The Launchpad wrapper object.573 :param Lp lp: The Launchpad wrapper object.
561 :param dict config: Configuration param:value map.574 :param dict[str, str] config: Configuration param:value map.
562 :rtype: int575 :rtype: int
563 :returns: Status code OK (0) on success, non-zero on error.576 :returns: Status code OK (0) on success, non-zero on error.
564 """577 """
@@ -592,11 +605,11 @@ def command_list(lp, config, filter_func=None):
592 return 1605 return 1
593606
594607
595def command_exists(lp, config):608def command_exists(lp: Lp, config: dict[str, str]) -> int:
596 """Checks if the named PPA exists in Launchpad.609 """Checks if the named PPA exists in Launchpad.
597610
598 :param Lp lp: The Launchpad wrapper object.611 :param Lp lp: The Launchpad wrapper object.
599 :param dict config: Configuration param:value map.612 :param dict[str, str] config: Configuration param:value map.
600 :rtype: int613 :rtype: int
601 :returns: Status code OK (0) on success, non-zero on error.614 :returns: Status code OK (0) on success, non-zero on error.
602 """615 """
@@ -609,11 +622,11 @@ def command_exists(lp, config):
609 return 1622 return 1
610623
611624
612def command_set(lp, config):625def command_set(lp: Lp, config: dict[str, str]) -> int:
613 """Sets one or more properties of PPA in Launchpad.626 """Sets one or more properties of PPA in Launchpad.
614627
615 :param Lp lp: The Launchpad wrapper object.628 :param Lp lp: The Launchpad wrapper object.
616 :param dict config: Configuration param:value map.629 :param dict[str, str] config: Configuration param:value map.
617 :rtype: int630 :rtype: int
618 :returns: Status code OK (0) on success, non-zero on error.631 :returns: Status code OK (0) on success, non-zero on error.
619 """632 """
@@ -632,6 +645,11 @@ def command_set(lp, config):
632 if 'displayname' in config:645 if 'displayname' in config:
633 the_ppa.archive.displayname = config['displayname']646 the_ppa.archive.displayname = config['displayname']
634647
648 if 'ppa_dependencies' in config:
649 # Split value on comma
650 ppa_addresses = unpack_to_dict(config.get('ppa_dependencies'))
651 the_ppa.set_dependencies(ppa_addresses)
652
635 if 'publish' in config:653 if 'publish' in config:
636 the_ppa.archive.publish = config.get('publish')654 the_ppa.archive.publish = config.get('publish')
637655
@@ -647,7 +665,7 @@ def command_set(lp, config):
647 return 1665 return 1
648666
649667
650def command_show(lp, config):668def command_show(lp: Lp, config: dict[str, str]) -> int:
651 """Displays details about the given PPA.669 """Displays details about the given PPA.
652670
653 :param Lp lp: The Launchpad wrapper object.671 :param Lp lp: The Launchpad wrapper object.
@@ -705,11 +723,11 @@ def command_show(lp, config):
705 return 1723 return 1
706724
707725
708def command_status(lp, config):726def command_status(lp: Lp, config: dict[str, str]) -> int:
709 """Displays current status of the given ppa.727 """Displays current status of the given ppa.
710728
711 :param Lp lp: The Launchpad wrapper object.729 :param Lp lp: The Launchpad wrapper object.
712 :param dict config: Configuration param:value map.730 :param dict[str, str] config: Configuration param:value map.
713 :rtype: int731 :rtype: int
714 :returns: Status code OK (0) on success, non-zero on error.732 :returns: Status code OK (0) on success, non-zero on error.
715 """733 """
@@ -729,11 +747,11 @@ def command_status(lp, config):
729 return 1747 return 1
730748
731749
732def command_wait(lp, config):750def command_wait(lp: Lp, config: dict[str, str]) -> int:
733 """Polls the PPA build status and block until all builds are finished and published.751 """Polls the PPA build status and block until all builds are finished and published.
734752
735 :param Lp lp: The Launchpad wrapper object.753 :param Lp lp: The Launchpad wrapper object.
736 :param dict config: Configuration param:value map.754 :param dict[str, str] config: Configuration param:value map.
737 :rtype: int755 :rtype: int
738 :returns: Status code OK (0) on success, non-zero on error.756 :returns: Status code OK (0) on success, non-zero on error.
739 """757 """
@@ -761,11 +779,11 @@ def command_wait(lp, config):
761 return 1779 return 1
762780
763781
764def command_tests(lp, config):782def command_tests(lp: Lp, config: dict[str, str]) -> int:
765 """Displays testing status for the PPA.783 """Displays testing status for the PPA.
766784
767 :param Lp lp: The Launchpad wrapper object.785 :param Lp lp: The Launchpad wrapper object.
768 :param dict config: Configuration param:value map.786 :param dict[str, str] config: Configuration param:value map.
769 :rtype: int787 :rtype: int
770 :returns: Status code OK (0) on success, non-zero on error.788 :returns: Status code OK (0) on success, non-zero on error.
771 """789 """
diff --git a/tests/helpers.py b/tests/helpers.py
index 2329125..29fa151 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -85,6 +85,11 @@ class LaunchpadMock:
8585
86class LpServiceMock:86class LpServiceMock:
87 """A stand-in for the Lp service object."""87 """A stand-in for the Lp service object."""
88 ROOT_URL = 'https://mocklaunchpad.net/'
89 API_ROOT_URL = 'https://api.mocklaunchpad.net/devel/'
90 BUGS_ROOT_URL = 'https://bugs.mocklaunchpad.net/'
91 CODE_ROOT_URL = 'https://code.mocklaunchpad.net/'
92
88 def __init__(self):93 def __init__(self):
89 self.launchpad = LaunchpadMock()94 self.launchpad = LaunchpadMock()
9095
diff --git a/tests/test_scripts_ppa.py b/tests/test_scripts_ppa.py
index a107f92..78aaeb3 100644
--- a/tests/test_scripts_ppa.py
+++ b/tests/test_scripts_ppa.py
@@ -235,6 +235,14 @@ def test_create_arg_parser_basic_config(command):
235 assert args.set_disabled is True235 assert args.set_disabled is True
236 args.set_disabled = False236 args.set_disabled = False
237237
238 # Check --ppa-dependencies <PPA[,...]>
239 args = parser.parse_args([command, 'test-ppa', '--ppa-dependencies', 'a,b,c'])
240 assert args.ppa_dependencies == "a,b,c"
241 args.ppa_dependencies = None
242 args = parser.parse_args([command, 'test-ppa', '--ppa-depends', 'a,b,c'])
243 assert args.ppa_dependencies == "a,b,c"
244 args.ppa_dependencies = None
245
238 # Check --publish246 # Check --publish
239 args = parser.parse_args([command, 'test-ppa', '--publish'])247 args = parser.parse_args([command, 'test-ppa', '--publish'])
240 assert args.publish is True248 assert args.publish is True
@@ -477,7 +485,8 @@ def test_command_create_with_architectures(monkeypatch, fake_config, architectur
477485
478@pytest.mark.xfail(reason="Unimplemented")486@pytest.mark.xfail(reason="Unimplemented")
479def test_command_desc(fake_config):487def test_command_desc(fake_config):
480 assert script.command_desc(fake_config) == 0488 lp = LpServiceMock()
489 assert script.command_desc(lp, fake_config) == 0
481 # TODO: Assert that if --dry-run specified, there are no actual490 # TODO: Assert that if --dry-run specified, there are no actual
482 # changes requested of launchpad491 # changes requested of launchpad
483 # TODO: Verify the description gets set as expected492 # TODO: Verify the description gets set as expected
@@ -485,29 +494,33 @@ def test_command_desc(fake_config):
485494
486@pytest.mark.xfail(reason="Unimplemented")495@pytest.mark.xfail(reason="Unimplemented")
487def test_command_destroy(fake_config):496def test_command_destroy(fake_config):
497 lp = LpServiceMock()
488 # TODO: Create a fake ppa to be destroyed498 # TODO: Create a fake ppa to be destroyed
489 assert script.command_destroy(fake_config) == 0499 assert script.command_destroy(lp, fake_config) == 0
490 # TODO: Verify the ppa is requested to be deleted500 # TODO: Verify the ppa is requested to be deleted
491501
492502
493@pytest.mark.xfail(reason="Unimplemented")503@pytest.mark.xfail(reason="Unimplemented")
494def test_command_list(fake_config):504def test_command_list(fake_config):
505 lp = LpServiceMock()
495 # TODO: Create a fake ppa with contents to be listed506 # TODO: Create a fake ppa with contents to be listed
496 assert script.command_list(fake_config) == 0507 assert script.command_list(lp, fake_config) == 0
497 # TODO: Verify the ppa addresses get listed508 # TODO: Verify the ppa addresses get listed
498509
499510
500@pytest.mark.xfail(reason="Unimplemented")511@pytest.mark.xfail(reason="Unimplemented")
501def test_command_exists(fake_config):512def test_command_exists(fake_config):
513 lp = LpServiceMock()
502 # TODO: Create fake ppa that exists514 # TODO: Create fake ppa that exists
503 assert script.command_exists(fake_config) == 0515 assert script.command_exists(lp, fake_config) == 0
504 # TODO: Verify this returns true when the ppa does exist516 # TODO: Verify this returns true when the ppa does exist
505517
506518
507@pytest.mark.xfail(reason="Unimplemented")519@pytest.mark.xfail(reason="Unimplemented")
508def test_command_not_exists(fake_config):520def test_command_not_exists(fake_config):
521 lp = LpServiceMock()
509 # TODO: Verify this returns true when the ppa does not exist522 # TODO: Verify this returns true when the ppa does not exist
510 assert script.command_exists(fake_config) == 1523 assert script.command_exists(lp, fake_config) == 1
511524
512525
513@pytest.mark.parametrize('params, expected_ppa_config', [526@pytest.mark.parametrize('params, expected_ppa_config', [
@@ -569,16 +582,19 @@ def test_command_set_architectures(fake_config, architectures, expected_processo
569582
570@pytest.mark.xfail(reason="Unimplemented")583@pytest.mark.xfail(reason="Unimplemented")
571def test_command_show(fake_config):584def test_command_show(fake_config):
572 assert script.command_show(fake_config) == 0585 lp = LpServiceMock()
586 assert script.command_show(lp, fake_config) == 0
573587
574588
575@pytest.mark.xfail(reason="Unimplemented")589@pytest.mark.xfail(reason="Unimplemented")
576def test_command_status(fake_config):590def test_command_status(fake_config):
577 assert script.command_status(fake_config) == 0591 lp = LpServiceMock()
592 assert script.command_status(lp, fake_config) == 0
578 # TODO: Capture stdout and compare with expected593 # TODO: Capture stdout and compare with expected
579594
580595
581@pytest.mark.xfail(reason="Unimplemented")596@pytest.mark.xfail(reason="Unimplemented")
582def test_command_wait(fake_config):597def test_command_wait(fake_config):
598 lp = LpServiceMock()
583 # TODO: Set wait period to 1 sec599 # TODO: Set wait period to 1 sec
584 assert script.command_wait(fake_config) == 0600 assert script.command_wait(lp, fake_config) == 0

Subscribers

People subscribed via source and target branches

to all changes: