Xqt has submitted this change and it was merged.
Change subject: Switch from string-based to os.path-based path management ......................................................................
Switch from string-based to os.path-based path management
Instead of doing string manipulation, we now use os.path.split and os.path.join to copy and delete the relevant i18n test file
Change-Id: I7f177ad85d135e347220ae9fa77ca0eeb8053541 --- M tests/i18n_tests.py 1 file changed, 4 insertions(+), 3 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/i18n_tests.py b/tests/i18n_tests.py index be8a542..8bef1e6 100644 --- a/tests/i18n_tests.py +++ b/tests/i18n_tests.py @@ -59,11 +59,12 @@
class TestTWTranslate(unittest.TestCase): def setUp(self): - self.path = os.path.realpath(__file__)[:-13] - shutil.copyfile(self.path + 'i18n/test.py', self.path + '../scripts/i18n/test.py') + self.path = os.path.split(os.path.realpath(__file__))[0] + shutil.copyfile(os.path.join(self.path, 'i18n', 'test.py'), + os.path.join(self.path, '..', 'scripts', 'i18n', 'test.py'))
def tearDown(self): - os.remove(self.path + '../scripts/i18n/test.py') + os.remove(os.path.join(self.path, '..', 'scripts', 'i18n', 'test.py'))
def testLocalized(self): self.assertEqual(i18n.twtranslate('en', 'test-localized'),