Skip to content

Commit e271f89

Browse files
committed
Fix windows folder sep in script
Add usage and dependency info, fix Windows folder seperator
1 parent 97d117a commit e271f89

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

tests/test_qrqualitycheck.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,19 @@
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
1818
# ---license-end
19+
#
20+
# Dependencies:
21+
# Python 3.9
22+
# pip install -r tests/requirements.txt
23+
#
24+
# Usage:
25+
# To run all tests: pytest
26+
# To run tests for a given country: pytest -C=<Country Code> . e.g. pytest -C=AT
1927

2028
import json
2129
from base64 import b64decode
2230
import base64
23-
from os import path
31+
import os
2432
from pathlib import Path
2533
from io import BytesIO
2634
from json import load
@@ -74,7 +82,7 @@ def pytest_generate_tests(metafunc):
7482
if "config_env" in metafunc.fixturenames:
7583
country_code = metafunc.config.getoption("country_code")
7684
file_name = metafunc.config.getoption("file_name")
77-
test_dir = path.dirname(path.dirname(path.abspath(__file__)))
85+
test_dir = os.dirname(os.path.dirname(os.path.abspath(__file__)))
7886
test_files = glob(
7987
str(Path(test_dir, country_code, "*", "*.png")), recursive=True)
8088
metafunc.parametrize("config_env", test_files, indirect=True)
@@ -263,8 +271,8 @@ def test_issuer_quality(config_env: Dict):
263271

264272
# If file path indicates JSON schema version, verify it against actual JSON schema version
265273
# E.g. "<countrycode>/1.0.0/VAC.png" will trigger schema version verification, whereas "<countrycode>/1.0.0/exceptions/VAC.png" will not
266-
if re.search("\\d\\.\\d\\.\\d", config_env[FILE_PATH].split("/")[-2]):
267-
path_schema_version = config_env[FILE_PATH].split("/")[-2]
274+
if re.search("\\d\\.\\d\\.\\d", config_env[FILE_PATH].split(os.sep)[-2]):
275+
path_schema_version = config_env[FILE_PATH].split(os.sep)[-2]
268276
dcc_schema_version = cose_payload[PAYLOAD_HCERT][PAYLOAD_ISSUER][VER]
269277
if path_schema_version != dcc_schema_version:
270278
fail("File path indicates {} but DCC contains {} JSON schema version".format(

0 commit comments

Comments
 (0)