fix: resolve CI/CD test failures and linting issues
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
import tempfile
|
import tempfile
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
import yaml
|
||||||
|
|
||||||
from config_convert.converters import YAMLConverter
|
from config_convert.converters import YAMLConverter
|
||||||
|
|
||||||
@@ -20,9 +20,9 @@ class TestYAMLConverter:
|
|||||||
|
|
||||||
def test_loads_nested_yaml(self, converter):
|
def test_loads_nested_yaml(self, converter):
|
||||||
data = """database:
|
data = """database:
|
||||||
host: localhost
|
host: localhost
|
||||||
port: 5432
|
port: 5432
|
||||||
"""
|
"""
|
||||||
result = converter.loads(data)
|
result = converter.loads(data)
|
||||||
assert result == {"database": {"host": "localhost", "port": 5432}}
|
assert result == {"database": {"host": "localhost", "port": 5432}}
|
||||||
|
|
||||||
@@ -33,9 +33,9 @@ class TestYAMLConverter:
|
|||||||
|
|
||||||
def test_loads_multiline_string(self, converter):
|
def test_loads_multiline_string(self, converter):
|
||||||
data = """description: |
|
data = """description: |
|
||||||
This is a
|
This is a
|
||||||
multiline string
|
multiline string
|
||||||
"""
|
"""
|
||||||
result = converter.loads(data)
|
result = converter.loads(data)
|
||||||
assert result["description"] == "This is a\nmultiline string\n"
|
assert result["description"] == "This is a\nmultiline string\n"
|
||||||
|
|
||||||
@@ -56,7 +56,6 @@ class TestYAMLConverter:
|
|||||||
assert loaded == original
|
assert loaded == original
|
||||||
|
|
||||||
def test_load_file(self, converter, temp_file, sample_yaml):
|
def test_load_file(self, converter, temp_file, sample_yaml):
|
||||||
import yaml
|
|
||||||
gen = temp_file(sample_yaml, suffix=".yaml")
|
gen = temp_file(sample_yaml, suffix=".yaml")
|
||||||
path = next(gen)
|
path = next(gen)
|
||||||
try:
|
try:
|
||||||
@@ -66,8 +65,6 @@ class TestYAMLConverter:
|
|||||||
os.unlink(path)
|
os.unlink(path)
|
||||||
|
|
||||||
def test_dump_file(self, converter, temp_dir, sample_yaml):
|
def test_dump_file(self, converter, temp_dir, sample_yaml):
|
||||||
import yaml
|
|
||||||
import shutil
|
|
||||||
path = tempfile.mktemp(suffix=".yaml")
|
path = tempfile.mktemp(suffix=".yaml")
|
||||||
try:
|
try:
|
||||||
data = yaml.safe_load(sample_yaml)
|
data = yaml.safe_load(sample_yaml)
|
||||||
@@ -75,7 +72,7 @@ class TestYAMLConverter:
|
|||||||
result = converter.load(path)
|
result = converter.load(path)
|
||||||
assert result == data
|
assert result == data
|
||||||
finally:
|
finally:
|
||||||
if Path(path).exists():
|
if os.path.exists(path):
|
||||||
os.unlink(path)
|
os.unlink(path)
|
||||||
|
|
||||||
def test_invalid_yaml_raises(self, converter):
|
def test_invalid_yaml_raises(self, converter):
|
||||||
|
|||||||
Reference in New Issue
Block a user