i18n, tests and more

This commit is contained in:
2024-05-25 22:12:11 +02:00
parent c21167f941
commit 161525fbb5
17 changed files with 117 additions and 58 deletions

View File

@@ -5,7 +5,7 @@ from pathlib import Path
from src.scan_folder import recursive_scan_folder
TEST_FOLDER = ".test_folder"
TEST_IMAGES = "tests/test_files"
TEST_IMAGES = f"tests{os.sep}test_files"
TEST_TEMP_FOLDER = os.path.join(TEST_FOLDER, 'Temp')
TEST_IMAGE_FOLDER = os.path.join(TEST_FOLDER, 'Images')
@@ -37,7 +37,7 @@ def copy_images(brand:str, model:str):
create_folders()
files = recursive_scan_folder(path=TEST_IMAGES)
for file in files:
file_name = file.split("/")[2:][0]
file_name = file.split(os.sep)[2:][0]
file_name = file_name.split("_")
if file_name[0] == brand and file_name[1] == model:
shutil.copy(src=file, dst=TEST_FOLDER)

View File

@@ -6,3 +6,5 @@ python3.12 -m pytest \
--cov-report xml:tests/coverage/coverage.xml \
--junitxml=tests/coverage/report.xml \
tests/
exit $?

View File

@@ -3,8 +3,10 @@ pip3.12 install -r requirements.txt
pip3.12 install -r develop_requirements.txt
pwd
sh tests/start_tests.sh
exit_code=$?
cp tests/coverage/coverage.xml ./coverage.xml
cp tests/coverage/report.xml ./report.xml
python3.12 tests/get_coverage_percent.py
exit $exit_code

View File

@@ -7,15 +7,18 @@ class TestConfig(unittest.TestCase):
def test_config_class(self):
test_config = {
"src": "/src/src",
"dst": "/src/dst"
"dst": "/src/dst",
"language": "en"
}
config = config_module.Config(test_config)
assert config.src == "/src/src"
assert config.dst == "/src/dst"
assert config.language == "en"
def test_get_config(self):
config_module.config_file = "src/config.yml"
config = config_module.get_config()
assert config.src == "../app/Temp"
assert config.dst == "../app/Bilder"
assert config.language == "en"

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="0" skipped="0" tests="0" time="0.024" timestamp="2024-03-17T01:13:57.781687" hostname="framework-13" /></testsuites>