launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25474
[Merge] ~cjwatson/launchpad:py3-excluded-scenarios into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-excluded-scenarios into launchpad:master.
Commit message:
Rephrase excluded_scenarios for Python 3 compatibility
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/392077
Per the Python Language Reference, "the scope of names defined in a class block is limited to the class block; it does not extend to the code blocks of methods". In Python 3, list comprehensions are implemented using a function scope, so they do not have access to names defined in the containing class block.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-excluded-scenarios into launchpad:master.
diff --git a/lib/lp/codehosting/tests/test_acceptance.py b/lib/lp/codehosting/tests/test_acceptance.py
index b753e3c..f9df88c 100644
--- a/lib/lp/codehosting/tests/test_acceptance.py
+++ b/lib/lp/codehosting/tests/test_acceptance.py
@@ -252,22 +252,20 @@ class SSHTestCase(TestCaseWithTransport, LoomTestMixin, TestCaseWithFactory):
class SmokeTest(WithScenarios, SSHTestCase):
"""Smoke test for repository support."""
- excluded_scenarios = [
- # RepositoryFormat4 is not initializable (breezy raises TestSkipped
- # when you try).
- 'RepositoryFormat4',
- # Fetching weave formats from the smart server is known to be broken.
- # See bug 173807 and breezy.tests.test_repository.
- 'RepositoryFormat5',
- 'RepositoryFormat6',
- 'RepositoryFormat7',
- 'GitRepositoryFormat',
- 'SvnRepositoryFormat',
- ]
-
scenarios = [
scenario for scenario in all_repository_format_scenarios()
- if scenario[0] not in excluded_scenarios
+ if scenario[0] not in {
+ # RepositoryFormat4 is not initializable (breezy raises
+ # TestSkipped when you try).
+ 'RepositoryFormat4',
+ # Fetching weave formats from the smart server is known to be
+ # broken. See bug 173807 and breezy.tests.test_repository.
+ 'RepositoryFormat5',
+ 'RepositoryFormat6',
+ 'RepositoryFormat7',
+ 'GitRepositoryFormat',
+ 'SvnRepositoryFormat',
+ }
and not scenario[0].startswith('RemoteRepositoryFormat')]
def setUp(self):
diff --git a/lib/lp/codehosting/tests/test_bzrutils.py b/lib/lp/codehosting/tests/test_bzrutils.py
index 4c14d73..df421e7 100644
--- a/lib/lp/codehosting/tests/test_bzrutils.py
+++ b/lib/lp/codehosting/tests/test_bzrutils.py
@@ -51,15 +51,13 @@ from lp.testing import TestCase
class TestGetBranchStackedOnURL(WithScenarios, TestCaseWithControlDir):
"""Tests for get_branch_stacked_on_url()."""
- excluded_scenarios = [
- 'BranchReferenceFormat',
- 'GitBranchFormat',
- 'SvnBranchFormat',
- ]
-
scenarios = [
scenario for scenario in branch_scenarios()
- if scenario[0] not in excluded_scenarios]
+ if scenario[0] not in {
+ 'BranchReferenceFormat',
+ 'GitBranchFormat',
+ 'SvnBranchFormat',
+ }]
def __str__(self):
"""Return the test id so that Zope test output shows the format."""