Skip to content

Commit c6e13cf

Browse files
committed
[test] Fix windows empty path exists error
Windows fails with a TypeError when handing an empty variable to os.path.exists().
1 parent 8cc7d7f commit c6e13cf

10 files changed

+10
-10
lines changed

test/test_doc_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def setUp(self):
2626
self.doc = doc
2727

2828
def tearDown(self):
29-
if os.path.exists(self.tmp_dir):
29+
if self.tmp_dir and os.path.exists(self.tmp_dir):
3030
shutil.rmtree(self.tmp_dir)
3131

3232
def save_load(self):

test/test_dtypes_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def setUp(self):
2929
self.doc = doc
3030

3131
def tearDown(self):
32-
if os.path.exists(self.tmp_dir):
32+
if self.tmp_dir and os.path.exists(self.tmp_dir):
3333
shutil.rmtree(self.tmp_dir)
3434

3535
def test_time(self):

test/test_format_converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def setUp(self):
2626
self.tmp_dir = None
2727

2828
def tearDown(self):
29-
if os.path.exists(self.tmp_dir):
29+
if self.tmp_dir and os.path.exists(self.tmp_dir):
3030
shutil.rmtree(self.tmp_dir)
3131

3232
@contextmanager

test/test_parser_json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def setUp(self):
115115
self.tmp_dir_path = create_test_dir(__file__)
116116

117117
def tearDown(self):
118-
if os.path.exists(self.tmp_dir_path):
118+
if self.tmp_dir_path and os.path.exists(self.tmp_dir_path):
119119
shutil.rmtree(self.tmp_dir_path)
120120

121121
def _prepare_doc(self, file_name, file_content):

test/test_parser_odml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def setUp(self):
3737
self.odml_doc = self.xml_reader.from_file(base_file)
3838

3939
def tearDown(self):
40-
if os.path.exists(self.tmp_dir):
40+
if self.tmp_dir and os.path.exists(self.tmp_dir):
4141
shutil.rmtree(self.tmp_dir)
4242

4343
def test_json_yaml_xml(self):

test/test_parser_yaml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def setUp(self):
7575
self.tmp_dir_path = create_test_dir(__file__)
7676

7777
def tearDown(self):
78-
if os.path.exists(self.tmp_dir_path):
78+
if self.tmp_dir_path and os.path.exists(self.tmp_dir_path):
7979
shutil.rmtree(self.tmp_dir_path)
8080

8181
def _prepare_doc(self, file_name, file_content):

test/test_property_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def setUp(self):
2828
self.doc = doc
2929

3030
def tearDown(self):
31-
if os.path.exists(self.tmp_dir):
31+
if self.tmp_dir and os.path.exists(self.tmp_dir):
3232
shutil.rmtree(self.tmp_dir)
3333

3434
def save_load(self):

test/test_section_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def setUp(self):
2727
self.doc = doc
2828

2929
def tearDown(self):
30-
if os.path.exists(self.tmp_dir):
30+
if self.tmp_dir and os.path.exists(self.tmp_dir):
3131
shutil.rmtree(self.tmp_dir)
3232

3333
def save_load(self):

test/test_version_converter_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def setUp(self):
2323
self.outfile = os.path.join(self.tmp_dir, "version_conversion.xml")
2424

2525
def tearDown(self):
26-
if os.path.exists(self.tmp_dir):
26+
if self.tmp_dir and os.path.exists(self.tmp_dir):
2727
shutil.rmtree(self.tmp_dir)
2828

2929
def test_convert_xml(self):

test/test_xml_writer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def setUp(self):
2626
self.writer = XMLWriter(doc)
2727

2828
def tearDown(self):
29-
if os.path.exists(self.tmp_dir):
29+
if self.tmp_dir and os.path.exists(self.tmp_dir):
3030
shutil.rmtree(self.tmp_dir)
3131

3232
def test_write_default(self):

0 commit comments

Comments
 (0)