Complete governed reporting execution and publication
This commit is contained in:
@@ -70,6 +70,34 @@ assert provider.contract_version == '1.0'
|
||||
_run_probe(script)
|
||||
|
||||
|
||||
def test_reporting_starts_without_files_or_mail_and_keeps_targets_optional() -> None:
|
||||
script = """
|
||||
import importlib.abc
|
||||
import sys
|
||||
|
||||
class Blocker(importlib.abc.MetaPathFinder):
|
||||
def find_spec(self, fullname, path=None, target=None):
|
||||
if fullname == 'govoplan_files' or fullname.startswith('govoplan_files.'):
|
||||
raise ModuleNotFoundError("Files is physically absent", name=fullname)
|
||||
if fullname == 'govoplan_mail' or fullname.startswith('govoplan_mail.'):
|
||||
raise ModuleNotFoundError("Mail is physically absent", name=fullname)
|
||||
return None
|
||||
|
||||
sys.meta_path.insert(0, Blocker())
|
||||
from govoplan_reporting.backend.contracts import (
|
||||
CAPABILITY_REPORTING_PUBLICATION_FILES,
|
||||
CAPABILITY_REPORTING_PUBLICATION_MAIL,
|
||||
)
|
||||
from govoplan_reporting.backend.manifest import get_manifest
|
||||
manifest = get_manifest()
|
||||
assert 'files' in manifest.optional_dependencies
|
||||
assert 'mail' in manifest.optional_dependencies
|
||||
assert CAPABILITY_REPORTING_PUBLICATION_FILES in manifest.capability_factories
|
||||
assert CAPABILITY_REPORTING_PUBLICATION_MAIL in manifest.capability_factories
|
||||
"""
|
||||
_run_probe(script)
|
||||
|
||||
|
||||
def _run_probe(source: str) -> None:
|
||||
environment = dict(os.environ)
|
||||
environment["PYTHONPATH"] = os.pathsep.join(
|
||||
|
||||
Reference in New Issue
Block a user