Skip to content

Commit 7ce32b2

Browse files
author
joseramon.afonso
committed
Added os.chdir in all test for fix Travis CI build
1 parent 4899425 commit 7ce32b2

File tree

5 files changed

+18
-19
lines changed

5 files changed

+18
-19
lines changed

tests/dataio/file.csv.gz

0 Bytes
Binary file not shown.

tests/dataio/fileio.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ class TestFileIO(unittest.TestCase):
1616
__GZIP_FILE = "".join((os.path.dirname(os.path.abspath(__file__)),
1717
os.sep, 'test_lookup.csv.gz'))
1818

19+
def setUp(self):
20+
os.chdir("{!s}{!s}".format(os.path.dirname(os.path.abspath(__file__)),
21+
os.sep))
22+
1923
def test_simple_file(self):
2024
reader = FileReader(self.__CLEAR_FILE)
2125
data = []

tests/devo_faker/template03

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{ fake.from_file("%s%stests.ds") }}
1+
{{ fake.from_file("tests.ds") }}

tests/devo_faker/template_parser.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,30 @@ def __init__(self, *args, **kwargs):
1313
super(TestTemplateParser, self).__init__(*args, **kwargs)
1414
self.parser = TemplateParser()
1515

16+
def setUp(self):
17+
os.chdir("{!s}{!s}".format(os.path.dirname(os.path.abspath(__file__)),
18+
os.sep))
19+
1620
def test_simple(self):
17-
with open("{!s}{!s}template01".format(
18-
os.path.dirname(os.path.abspath(__file__)), os.sep), 'r') \
19-
as content_file:
21+
with open("./template01") as content_file:
2022
text = content_file.read()
2123
result = self.parser.process(text)
2224
self.assertTrue(result == 'test1\ntest2')
2325

2426
def test_with_faker(self):
25-
with open("{!s}{!s}template02".format(
26-
os.path.dirname(os.path.abspath(__file__)), os.sep), 'r') \
27-
as content_file:
27+
with open("./template02") as content_file:
2828
text = content_file.read()
2929
result = self.parser.process(text)
3030
self.assertTrue(re.match("test\d+", result))
3131

3232
def test_with_faker_from_file(self):
33-
with open("{!s}{!s}template03".format(
34-
os.path.dirname(os.path.abspath(__file__)), os.sep), 'r') \
35-
as content_file:
33+
with open("./template03") as content_file:
3634
text = content_file.read()
37-
text = text % (os.path.dirname(os.path.abspath(__file__)), os.sep)
3835
result = self.parser.process(text)
3936
self.assertTrue(re.match("test\d+", result))
4037

4138
def test_with_faker_more_complicated(self):
42-
with open("{!s}{!s}template04".format(
43-
os.path.dirname(os.path.abspath(__file__)), os.sep), 'r') \
44-
as content_file:
39+
with open("./template04") as content_file:
4540
text = content_file.read()
4641
start_date = parser.parse("01-01-2018 00:00:00")
4742
end_date = parser.parse("01-01-2018 00:05:00")

tests/sorter/file_sorter.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ def _create_random_regex_date_file(length, rows, file_source):
4343

4444

4545
class TestSimpleSorter(unittest.TestCase):
46-
FOLDER_PATH = "{!s}{!s}".format(os.path.dirname(os.path.abspath(__file__)),
47-
os.sep)
48-
__DATAFILE__ = "{!s}testData.log".format(FOLDER_PATH)
49-
__DATAFILE2__ = "{!s}testData2.log".format(FOLDER_PATH)
50-
__TARGETFILE__ = "{!s}outputData.log".format(FOLDER_PATH)
46+
__DATAFILE__ = "testData.log"
47+
__DATAFILE2__ = "testData2.log"
48+
__TARGETFILE__ = "outputData.log"
5149

5250
def __init__(self, *args, **kwargs):
5351
super(TestSimpleSorter, self).__init__(*args, **kwargs)
5452
self.sorter = Sorter()
53+
os.chdir("{!s}{!s}".format(os.path.dirname(os.path.abspath(__file__)),
54+
os.sep))
5555

5656
def test_str_skip_rows(self):
5757
self.__delete_target_file()

0 commit comments

Comments
 (0)