Skip to content

Commit 656b982

Browse files
committed
Updates for Windows tests
1 parent ad2059a commit 656b982

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

tests/modules/compare_configs/test_compare_configs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
"""Tests for compare module."""
22
import pytest
3+
import os
34
from nelkit.exceptions import NelkitException
45
from nelkit.modules.compare_configs.settings import CompareConfigs
6+
s = os.sep
57

68

79
BASE_DIR = 'tests/modules/compare_configs/data/'
@@ -36,4 +38,5 @@ def test_invalid_config_between_missing_start():
3638
def test_basic_diff():
3739
"""Basic basic diff of the compare module, and check that no exceptions are raised."""
3840
run = CompareConfigs(settings_file=BASE_RULES)
39-
assert basic_diff == run._diff['tests/modules/compare_configs/data/configs/basic/file_b.ios'][2]
41+
assert basic_diff == run._diff['tests%smodules%scompare_configs%sdata%sconfigs%sbasic%sfile_b.ios' % (
42+
s, s, s, s, s, s)][2]
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)