mirror of
https://github.com/sherlock-project/sherlock
synced 2024-11-21 19:33:02 +00:00
Adjust ci paths
This commit is contained in:
parent
ca781a3c3b
commit
267e5a6979
5 changed files with 10 additions and 10 deletions
|
@ -6,18 +6,18 @@ from sherlock_project.sites import SitesInformation
|
||||||
|
|
||||||
@pytest.fixture()
|
@pytest.fixture()
|
||||||
def sites_obj():
|
def sites_obj():
|
||||||
sites_obj = SitesInformation(data_file_path=os.path.join(os.path.dirname(__file__), "../sherlock/resources/data.json"))
|
sites_obj = SitesInformation(data_file_path=os.path.join(os.path.dirname(__file__), "../sherlock_project/resources/data.json"))
|
||||||
yield sites_obj
|
yield sites_obj
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
def sites_info():
|
def sites_info():
|
||||||
sites_obj = SitesInformation(data_file_path=os.path.join(os.path.dirname(__file__), "../sherlock/resources/data.json"))
|
sites_obj = SitesInformation(data_file_path=os.path.join(os.path.dirname(__file__), "../sherlock_project/resources/data.json"))
|
||||||
sites_iterable = {site.name: site.information for site in sites_obj}
|
sites_iterable = {site.name: site.information for site in sites_obj}
|
||||||
yield sites_iterable
|
yield sites_iterable
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
def remote_schema():
|
def remote_schema():
|
||||||
schema_url: str = 'https://raw.githubusercontent.com/sherlock-project/sherlock/master/sherlock/resources/data.schema.json'
|
schema_url: str = 'https://raw.githubusercontent.com/sherlock-project/sherlock/master/sherlock_project/resources/data.schema.json'
|
||||||
with urllib.request.urlopen(schema_url) as remoteschema:
|
with urllib.request.urlopen(schema_url) as remoteschema:
|
||||||
schemadat = json.load(remoteschema)
|
schemadat = json.load(remoteschema)
|
||||||
yield schemadat
|
yield schemadat
|
||||||
|
|
|
@ -25,7 +25,7 @@ class Interactives:
|
||||||
"""Check all files within the Sherlock package for matching patterns"""
|
"""Check all files within the Sherlock package for matching patterns"""
|
||||||
pattern:re.Pattern = re.compile(pattern)
|
pattern:re.Pattern = re.compile(pattern)
|
||||||
matching_files:list[str] = []
|
matching_files:list[str] = []
|
||||||
for root, dirs, files in os.walk("sherlock"):
|
for root, dirs, files in os.walk("sherlock_project"):
|
||||||
for file in files:
|
for file in files:
|
||||||
file_path = os.path.join(root,file)
|
file_path = os.path.join(root,file)
|
||||||
if "__pycache__" in file_path:
|
if "__pycache__" in file_path:
|
||||||
|
|
|
@ -5,8 +5,8 @@ from jsonschema import validate
|
||||||
|
|
||||||
def test_validate_manifest_against_local_schema():
|
def test_validate_manifest_against_local_schema():
|
||||||
"""Ensures that the manifest matches the local schema, for situations where the schema is being changed."""
|
"""Ensures that the manifest matches the local schema, for situations where the schema is being changed."""
|
||||||
json_relative: str = '../sherlock/resources/data.json'
|
json_relative: str = '../sherlock_project/resources/data.json'
|
||||||
schema_relative: str = '../sherlock/resources/data.schema.json'
|
schema_relative: str = '../sherlock_project/resources/data.schema.json'
|
||||||
|
|
||||||
json_path: str = os.path.join(os.path.dirname(__file__), json_relative)
|
json_path: str = os.path.join(os.path.dirname(__file__), json_relative)
|
||||||
schema_path: str = os.path.join(os.path.dirname(__file__), schema_relative)
|
schema_path: str = os.path.join(os.path.dirname(__file__), schema_relative)
|
||||||
|
@ -22,7 +22,7 @@ def test_validate_manifest_against_local_schema():
|
||||||
@pytest.mark.online
|
@pytest.mark.online
|
||||||
def test_validate_manifest_against_remote_schema(remote_schema):
|
def test_validate_manifest_against_remote_schema(remote_schema):
|
||||||
"""Ensures that the manifest matches the remote schema, so as to not unexpectedly break clients."""
|
"""Ensures that the manifest matches the remote schema, so as to not unexpectedly break clients."""
|
||||||
json_relative: str = '../sherlock/resources/data.json'
|
json_relative: str = '../sherlock_project/resources/data.json'
|
||||||
json_path: str = os.path.join(os.path.dirname(__file__), json_relative)
|
json_path: str = os.path.join(os.path.dirname(__file__), json_relative)
|
||||||
|
|
||||||
with open(json_path, 'r') as f:
|
with open(json_path, 'r') as f:
|
||||||
|
|
|
@ -10,8 +10,8 @@ def test_versioning() -> None:
|
||||||
found:list = Interactives.walk_sherlock_for_files_with(r'__version__ *= *')
|
found:list = Interactives.walk_sherlock_for_files_with(r'__version__ *= *')
|
||||||
expected:list = [
|
expected:list = [
|
||||||
# Normalization is REQUIRED for Windows ( / vs \ )
|
# Normalization is REQUIRED for Windows ( / vs \ )
|
||||||
os.path.normpath("sherlock/__init__.py"),
|
os.path.normpath("sherlock_project/__init__.py"),
|
||||||
os.path.normpath("sherlock/sherlock.py"),
|
os.path.normpath("sherlock_project/sherlock.py"),
|
||||||
]
|
]
|
||||||
# Sorting is REQUIRED for Mac
|
# Sorting is REQUIRED for Mac
|
||||||
assert sorted(found) == sorted(expected)
|
assert sorted(found) == sorted(expected)
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -18,7 +18,7 @@ deps =
|
||||||
pytest
|
pytest
|
||||||
allowlist_externals = coverage
|
allowlist_externals = coverage
|
||||||
commands =
|
commands =
|
||||||
coverage run --source=sherlock --module pytest -v
|
coverage run --source=sherlock_project --module pytest -v
|
||||||
coverage report --show-missing
|
coverage report --show-missing
|
||||||
|
|
||||||
[testenv:offline]
|
[testenv:offline]
|
||||||
|
|
Loading…
Reference in a new issue