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