Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester committed Feb 15, 2024
1 parent 72c3397 commit 0ed4c16
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 8 deletions.
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ readme = "README.md"
python = "^3.11"
snakemake-interface-common = "^1.16.0"

[tool.poetry.dev-dependencies]
[tool.poetry.group.dev.dependencies]
pytest = "^8.0.0"
snakemake = { git = "https://github.com/snakemake/snakemake.git", branch = "feat/report-plugins" }
black = "^24.2.0"
flake8 = "^7.0.0"
coverage = "^7.4.1"

[tool.poetry.group.dev.dependencies]
pytest = "^8.0.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
4 changes: 2 additions & 2 deletions snakemake_interface_report_plugins/registry/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from snakemake_interface_report_plugins.settings import (
ReportSettingsBase,
)
from snakemake_interface_storage_plugins import common
from snakemake_interface_report_plugins import common

from snakemake_interface_common.plugin_registry.plugin import PluginBase

Expand All @@ -25,7 +25,7 @@ def name(self):

@property
def cli_prefix(self):
return "report-" + self.name.replace(common.storage_plugin_module_prefix, "")
return "report-" + self.name.replace(common.report_plugin_module_prefix, "")

@property
def settings_cls(self):
Expand Down
4 changes: 2 additions & 2 deletions snakemake_interface_report_plugins/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

from abc import ABC, abstractmethod
from typing import List, Mapping
from snakemake_interface_report_plugin.interfaces import (
from snakemake_interface_report_plugins.interfaces import (
CategoryInterface,
ConfigFileRecordInterface,
JobRecordInterface,
RuleRecordInterface,
)
from snakemake_interface_report_plugin.settings import ReportSettingsBase
from snakemake_interface_report_plugins.settings import ReportSettingsBase
from snakemake_interface_report_plugins.interfaces import DAGReportInterface


Expand Down
Empty file removed tests/__init__.py
Empty file.
33 changes: 33 additions & 0 deletions tests/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from typing import List
from snakemake_interface_report_plugins.registry import ReportPluginRegistry
from snakemake_interface_common.plugin_registry.tests import TestRegistryBase
from snakemake_interface_common.plugin_registry.plugin import PluginBase, SettingsBase
from snakemake_interface_common.plugin_registry import PluginRegistryBase

from snakemake.report import html_reporter


class TestRegistry(TestRegistryBase):
__test__ = True

def get_registry(self) -> PluginRegistryBase:

# ensure that the singleton is reset
ReportPluginRegistry._instance = None
registry = ReportPluginRegistry()
registry.register_plugin("html", html_reporter)

return registry

def get_test_plugin_name(self) -> str:
return "html"

def validate_plugin(self, plugin: PluginBase):
assert plugin._report_settings_cls is not None
assert plugin.reporter is not None

def validate_settings(self, settings: SettingsBase, plugin: PluginBase):
assert isinstance(settings, plugin._report_settings_cls)

def get_example_args(self) -> List[str]:
return ["--report-html-path", "report.zip"]

0 comments on commit 0ed4c16

Please sign in to comment.