fix tests on Windows with Python 2
This commit is contained in:
parent
c7434cb75b
commit
cac2f5a9be
1 changed files with 6 additions and 2 deletions
|
@ -2,13 +2,14 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from wakatime.compat import u
|
from wakatime.compat import u
|
||||||
from wakatime.packages.requests.models import Response
|
from wakatime.packages.requests.models import Response
|
||||||
from wakatime.utils import BACKSLASH_REPLACE_PATTERN
|
from wakatime.utils import BACKSLASH_REPLACE_PATTERN, WINDOWS_DRIVE_PATTERN
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -73,7 +74,10 @@ class TestCase(unittest.TestCase):
|
||||||
self.assertEquals(first_list, second_list)
|
self.assertEquals(first_list, second_list)
|
||||||
|
|
||||||
def normalize_path(self, path):
|
def normalize_path(self, path):
|
||||||
return re.sub(BACKSLASH_REPLACE_PATTERN, '/', path)
|
filepath = re.sub(BACKSLASH_REPLACE_PATTERN, '/', path)
|
||||||
|
if platform.system() == 'Windows' and WINDOWS_DRIVE_PATTERN.match(filepath):
|
||||||
|
filepath = filepath.capitalize()
|
||||||
|
return filepath
|
||||||
|
|
||||||
def assertPathsEqual(self, first_path, second_path, message=None):
|
def assertPathsEqual(self, first_path, second_path, message=None):
|
||||||
if message:
|
if message:
|
||||||
|
|
Loading…
Reference in a new issue