launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29845
[Merge] ~ines-almeida/launchpad:refactor-itermitently-failing-test into launchpad:master
Ines Almeida has proposed merging ~ines-almeida/launchpad:refactor-itermitently-failing-test into launchpad:master.
Commit message:
Update test so that it doesn't fail intermittently
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~ines-almeida/launchpad/+git/launchpad/+merge/440112
Test fails intermittently when a random() happens to be close to 0.
Instead of fetching self.now as the current time, we are setting it to the current transaction timestamp instead, so it's more robust.
As it was, the test passed 99.9% of time, so it's hard to ensure that it won't fail again. Ran it 20 times and they all passed.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~ines-almeida/launchpad:refactor-itermitently-failing-test into launchpad:master.
diff --git a/lib/canonical/launchpad/icing/css/typography.scss b/lib/canonical/launchpad/icing/css/typography.scss
index 1e58f29..27bb84d 100644
--- a/lib/canonical/launchpad/icing/css/typography.scss
+++ b/lib/canonical/launchpad/icing/css/typography.scss
@@ -1,6 +1,6 @@
// This file the result of auto-converting typography.css to scss.
-$page-width: 45em;
+$page-width: 60em;
$wider-page: $page-width + 15em;
$reduced-spacing: 0.8em;
$link-colour: #03a;
@@ -45,7 +45,7 @@ h1, h2, h3, h4, h5, h6 {
margin-top: $reduced-spacing;
}
- p, li, dt, dd, blockquote, .narrow, .narrow-listing {
+ li, dt, dd, blockquote, .narrow, .narrow-listing {
/* Wrap the text before the eye gets lost. */
max-width: $page-width;
}
diff --git a/lib/lp/bugs/tests/test_bugtracker.py b/lib/lp/bugs/tests/test_bugtracker.py
index 5c9cdca..3d60dd7 100644
--- a/lib/lp/bugs/tests/test_bugtracker.py
+++ b/lib/lp/bugs/tests/test_bugtracker.py
@@ -9,6 +9,7 @@ from urllib.parse import urlencode
import responses
import transaction
from lazr.lifecycle.snapshot import Snapshot
+from storm.store import Store
from testtools.matchers import Equals, MatchesListwise, MatchesStructure
from zope.component import getUtility
from zope.security.interfaces import Unauthorized
@@ -23,6 +24,7 @@ from lp.bugs.model.bugtracker import (
make_bugtracker_title,
)
from lp.registry.interfaces.person import IPersonSet
+from lp.services.database.sqlbase import get_transaction_timestamp
from lp.testing import (
TestCase,
TestCaseWithFactory,
@@ -91,7 +93,8 @@ class BugTrackerTestCase(TestCaseWithFactory):
for i in range(5):
self.factory.makeBugWatch(bugtracker=self.bug_tracker)
- self.now = datetime.now(timezone.utc)
+ store = Store.of(self.bug_tracker)
+ self.now = get_transaction_timestamp(store)
def test_multi_product_constraints_observed(self):
"""BugTrackers for which multi_product=True should return None
Follow ups