Skip to content

Commit c3f158a

Browse files
keatingedbieber
authored andcommitted
Fix failing tests on Windows due to hardcoded file paths (google#30)
* Fix failing tests on Windows due to hardcoded file paths
1 parent babf4f1 commit c3f158a

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

fire/helputils_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import six
2222

2323
import unittest
24+
import os
2425

2526

2627
class HelpUtilsTest(unittest.TestCase):
@@ -120,7 +121,7 @@ def testHelpClassNoInit(self):
120121
self.assertIn('Type: type\n', helpstring)
121122
self.assertIn('String form: ', helpstring)
122123
self.assertIn('fire.test_components.OldStyleEmpty', helpstring)
123-
self.assertIn('fire/test_components.py\n', helpstring)
124+
self.assertIn(os.path.join('fire', 'test_components.py'), helpstring)
124125
self.assertIn('Line: ', helpstring)
125126

126127

fire/inspectutils_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import unittest
2020
import six
21+
import os
2122

2223
from fire import inspectutils
2324
from fire import test_components as tc
@@ -97,7 +98,7 @@ def testInfoOne(self):
9798
def testInfoClass(self):
9899
info = inspectutils.Info(tc.NoDefaults)
99100
self.assertEqual(info.get('type_name'), 'type')
100-
self.assertIn('fire/test_components.py', info.get('file'))
101+
self.assertIn(os.path.join('fire', 'test_components.py'), info.get('file'))
101102
self.assertGreater(info.get('line'), 0)
102103

103104
def testInfoClassNoInit(self):
@@ -106,7 +107,7 @@ def testInfoClassNoInit(self):
106107
self.assertEqual(info.get('type_name'), 'classobj')
107108
else:
108109
self.assertEqual(info.get('type_name'), 'type')
109-
self.assertIn('fire/test_components.py', info.get('file'))
110+
self.assertIn(os.path.join('fire', 'test_components.py'), info.get('file'))
110111
self.assertGreater(info.get('line'), 0)
111112

112113

0 commit comments

Comments
 (0)