Skip to content

Commit 62c5eb3

Browse files
committed
Updates for Windows tests
1 parent ad2059a commit 62c5eb3

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
"""Tests to validate yaml features."""
22
from nelkit.exceptions import FileNotFound, ParsingError
33
from nelkit.parsing.yaml.loader import YamlLoader
4+
import os
45
import pytest
6+
s = os.sep
57

68

79
def test_YamlLoader():
810
"""Test to see that the YamlLoader returns a dict."""
9-
yl = YamlLoader(filename='tests/parsing/yaml/data/base.yml')
11+
yl = YamlLoader(filename='tests%sparsing%syaml%sdata%sbase.yml' % (s, s, s, s))
1012
assert isinstance(yl.data, dict)
1113

1214

1315
def test_load_missing_file():
1416
"""Test to verify that an exception is raised when trying to load a non-existing file."""
1517
with pytest.raises(FileNotFound) as excinfo:
16-
YamlLoader(filename='tests/parsing/yaml/data/file_that_does_not_exist.yml')
17-
assert 'Unable to read: tests/parsing/yaml/data/file_that_does_not_exist.yml' == str(excinfo.value)
18+
YamlLoader(filename='tests%sparsing%syaml%sdata%sfile_that_does_not_exist.yml' % (s, s, s, s))
19+
assert 'Unable to read: tests%sparsing%syaml%sdata%sfile_that_does_not_exist.yml' % (
20+
s, s, s, s) == str(excinfo.value)
1821

1922

2023
def test_load_invalid_file():
2124
"""Test to verify that an exception is raised when the yaml file is invalid."""
2225
with pytest.raises(ParsingError) as excinfo:
23-
YamlLoader(filename='tests/parsing/yaml/data/invalid_yaml.yml')
24-
assert 'tests/parsing/yaml/data/invalid_yaml.yml is not a valid yaml file' == str(excinfo.value)
26+
YamlLoader(filename='tests%sparsing%syaml%sdata%sinvalid_yaml.yml' % (s, s, s, s))
27+
assert 'tests%sparsing%syaml%sdata%sinvalid_yaml.yml is not a valid yaml file' % (
28+
s, s, s, s) == str(excinfo.value)

0 commit comments

Comments
 (0)