Skip to content

Commit

Permalink
Merge pull request #1360 from meejah/4091.fragile
Browse files Browse the repository at this point in the history
Fix fragile unit-test (4091)

Fixes ticket:4091
  • Loading branch information
itamarst committed Feb 27, 2024
2 parents 3afd2dc + 825e42c commit a23a97d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Empty file added newsfragments/4091.minor
Empty file.
3 changes: 2 additions & 1 deletion src/allmydata/test/test_humanreadable.py
Expand Up @@ -27,7 +27,8 @@ def __init__(self):
class HumanReadable(unittest.TestCase):
def test_repr(self):
hr = humanreadable.hr
self.failUnlessEqual(hr(foo), "<foo() at test_humanreadable.py:20>")
# we match on regex so this test isn't fragile about line-numbers
self.assertRegex(hr(foo), r"<foo\(\) at test_humanreadable.py:\d+>")
self.failUnlessEqual(hr(self.test_repr),
"<bound method HumanReadable.test_repr of <allmydata.test.test_humanreadable.HumanReadable testMethod=test_repr>>")
self.failUnlessEqual(hr(long(1)), "1")
Expand Down

0 comments on commit a23a97d

Please sign in to comment.