Skip to content

Commit

Permalink
Mods to support "1.0" &etc. as valid versions
Browse files Browse the repository at this point in the history
  • Loading branch information
jswelling committed Apr 18, 2024
1 parent ac0226c commit aa37cf5
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class CodexCommonErrorsValidator(Validator):

description = "Test for common problems found in CODEX"
cost = 1.0
version = "1.0.0"
version = "1.0"
required = "codex"

def collect_errors(self, **kwargs) -> List[str]:
Expand Down
2 changes: 1 addition & 1 deletion src/ingest_validation_tests/codex_json_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class CodexJsonValidator(Validator):
description = "Check CODEX JSON against schema"
cost = 1.0
version = "1.0.0"
version = "1.0"
required = "codex"

def collect_errors(self, **kwargs) -> List[str]:
Expand Down
2 changes: 1 addition & 1 deletion src/ingest_validation_tests/fastq_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class FASTQValidator(Validator):
description = "Check FASTQ files for basic syntax and consistency."
cost = 15.0
version = "1.0.0"
version = "1.0"

def collect_errors(self, **kwargs) -> List[str]:
threads = kwargs.get("coreuse", None) or cpu_count() // 4 or 1
Expand Down
2 changes: 1 addition & 1 deletion src/ingest_validation_tests/gz_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __call__(self, filename):
class GZValidator(Validator):
description = "Recursively checking gzipped files for damage using multiprocessing pools"
cost = 5.0
version = "1.0.0"
version = "1.0"

def collect_errors(self, **kwargs) -> List[str]:
data_output2 = []
Expand Down
2 changes: 1 addition & 1 deletion src/ingest_validation_tests/ome_tiff_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def _check_ome_tiff_file(file: str):
class OmeTiffValidator(Validator):
description = "Recursively test all ome-tiff files for validity"
cost = 1.0
version = "1.0.0"
version = "1.0"

def collect_errors(self, **kwargs) -> List[str]:
threads = kwargs.get("coreuse", None) or cpu_count() // 4 or 1
Expand Down
2 changes: 1 addition & 1 deletion src/ingest_validation_tests/publication_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PublicationValidator(Validator):

description = "Test for common problems found in publications"
cost = 1.0
version = "1.0.0"
version = "1.0"
base_url_re = r"(\s*\{\{\s*base_url\s*\}\})/(.*)"
url_re = r"[Uu][Rr][Ll]"
required = "publication"
Expand Down
2 changes: 1 addition & 1 deletion src/ingest_validation_tests/tiff_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _check_tiff_file(path: str) -> Optional[str]:
class TiffValidator(Validator):
description = "Recursively test all tiff files that are not ome.tiffs for validity"
cost = 1.0
version = "1.0.0"
version = "1.0"

def collect_errors(self, **kwargs) -> List[str]:
threads = kwargs.get("coreuse", None) or cpu_count() // 4 or 1
Expand Down
10 changes: 7 additions & 3 deletions tests/test_semantic_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@

from ingest_validation_tools.plugin_validator import validation_class_iter

FALLBACK_REGEX = r"^\d+\.\d+$"

def test_plugin_semantic_versions():
plugin_dir = (Path(__file__).parent.parent
/ "src" / "ingest_validation_tests")
classnames = []
fb_regex = re.compile(FALLBACK_REGEX)
for cls in validation_class_iter(plugin_dir):
validator = cls(['.'], 'someassay', plugin_dir, [])
try:
ver = semantic_version.Version(cls.version)
except ValueError as excp:
assert False, (f"The plugin {cls.__name__} has version string"
f" {cls.version}, which is not a valid semantic"
" version")
if not fb_regex.match(cls.version):
assert False, (f"The plugin {cls.__name__} has version string"
f" {cls.version}, which is not a valid semantic"
" version")

0 comments on commit aa37cf5

Please sign in to comment.