Skip to content
This repository was archived by the owner on Oct 9, 2021. It is now read-only.

Commit c6a5bf4

Browse files
committed
expect correct exception class for py3
1 parent 0ca8a93 commit c6a5bf4

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

tests/test_project.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def test_ioerror_when_reading_git_branch(self, logs):
190190

191191
self.assertNothingPrinted()
192192
actual = self.getLogOutput(logs)
193-
expected = 'OSError' if self.isPy35OrNewer else 'IOError'
193+
expected = 'OSError' if self.isPy33OrNewer else 'IOError'
194194
self.assertIn(expected, actual)
195195

196196
def test_git_detached_head_not_used_as_branch(self):
@@ -350,7 +350,7 @@ def test_ioerror_when_reading_mercurial_branch(self, logs):
350350

351351
self.assertNothingPrinted()
352352
actual = self.getLogOutput(logs)
353-
expected = 'OSError' if self.isPy35OrNewer else 'IOError'
353+
expected = 'OSError' if self.isPy33OrNewer else 'IOError'
354354
self.assertIn(expected, actual)
355355

356356
def test_git_submodule_detected(self):
@@ -503,7 +503,7 @@ def test_git_find_path_from_submodule_handles_exceptions(self, logs):
503503
self.assertIsNone(result)
504504
self.assertNothingPrinted()
505505
actual = self.getLogOutput(logs)
506-
expected = 'OSError' if self.isPy35OrNewer else 'IOError'
506+
expected = 'OSError' if self.isPy33OrNewer else 'IOError'
507507
self.assertIn(expected, actual)
508508

509509
@log_capture()

tests/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ def isPy35OrNewer(self):
150150
return True
151151
return (sys.version_info[0] >= 3 and sys.version_info[1] >= 5)
152152

153+
@property
154+
def isPy33OrNewer(self):
155+
if sys.version_info[0] > 3:
156+
return True
157+
return (sys.version_info[0] >= 3 and sys.version_info[1] >= 3)
158+
153159

154160
try:
155161
# Python >= 3

0 commit comments

Comments
 (0)