Skip to content

Commit 758dbde

Browse files
author
notactuallyfinn
committed
reactivated tests and added afew log calls
1 parent 296fbb7 commit 758dbde

11 files changed

Lines changed: 16 additions & 29 deletions

File tree

src/hermes/commands/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from hermes.commands.base import HermesHelpCommand
1212
from hermes.commands.base import HermesVersionCommand
1313
from hermes.commands.clean.base import HermesCleanCommand
14-
# from hermes.commands.init.base import HermesInitCommand
14+
from hermes.commands.init.base import HermesInitCommand
1515
from hermes.commands.curate.base import HermesCurateCommand
1616
from hermes.commands.harvest.base import HermesHarvestCommand
1717
from hermes.commands.process.base import HermesProcessCommand

src/hermes/commands/cli.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,9 @@
1212
import sys
1313

1414
from hermes import logger
15-
# FIXME: remove comments after new implementation of modules is available
16-
# from hermes.commands import (HermesHelpCommand, HermesVersionCommand, HermesCleanCommand,
17-
# HermesHarvestCommand, HermesProcessCommand, HermesCurateCommand,
18-
# HermesDepositCommand, HermesPostprocessCommand, HermesInitCommand)
1915
from hermes.commands import (
20-
HermesCurateCommand, HermesDepositCommand, HermesHarvestCommand, HermesHelpCommand, HermesPostprocessCommand,
21-
HermesProcessCommand, HermesVersionCommand
16+
HermesCurateCommand, HermesCleanCommand, HermesDepositCommand, HermesHarvestCommand, HermesHelpCommand,
17+
HermesInitCommand, HermesPostprocessCommand, HermesProcessCommand, HermesVersionCommand
2218
)
2319
from hermes.commands.base import HermesCommand
2420
from hermes.error import HermesPluginRunError
@@ -42,12 +38,12 @@ def main() -> None:
4238
setting_types = {}
4339

4440
for command in (
45-
# HermesCleanCommand(parser),
41+
HermesCleanCommand(parser),
4642
HermesCurateCommand(parser),
4743
HermesDepositCommand(parser),
4844
HermesHarvestCommand(parser),
4945
HermesHelpCommand(parser),
50-
# HermesInitCommand(parser),
46+
HermesInitCommand(parser),
5147
HermesPostprocessCommand(parser),
5248
HermesProcessCommand(parser),
5349
HermesVersionCommand(parser),

src/hermes/commands/curate/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __call__(self, command: HermesCommand, metadata: SoftwareMetadata) -> Softwa
2525
class CurateSettings(BaseModel):
2626
"""Generic deposition settings."""
2727

28-
plugin: str = ""
28+
plugin: str = "pass_curate"
2929

3030

3131
class HermesCurateCommand(HermesCommand):
@@ -51,15 +51,15 @@ def __call__(self, args: argparse.Namespace) -> None:
5151
raise HermesValidationError("The results of the process step are invalid.") from e
5252
ctx.finalize_step("process")
5353

54-
self.log.info("## Load curation plugin")
54+
self.log.info(f"## Load curation plugin {plugin_name}")
5555
# load plugin
5656
try:
5757
plugin_func = self.plugins[plugin_name]()
5858
except KeyError:
5959
self.log.error(f"Plugin {plugin_name} not found.")
6060
raise MisconfigurationError(f"Curate plugin {plugin_name} not found.")
6161

62-
self.log.info("## Run curation plugin")
62+
self.log.info(f"## Run curation plugin {plugin_name}")
6363
# run plugin
6464
try:
6565
curated_metadata = plugin_func(self, metadata)

src/hermes/commands/deposit/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,15 @@ def __call__(self, args: argparse.Namespace) -> None:
139139
self.args = args
140140
plugin_name = self.settings.target
141141

142-
self.log.info("## Load deposit plugin")
142+
self.log.info(f"## Load deposit plugin {plugin_name}")
143143
# load plugin
144144
try:
145145
plugin_func = self.plugins[plugin_name]()
146146
except KeyError:
147147
self.log.error(f"Plugin {plugin_name} not found.")
148148
raise MisconfigurationError(f"Deposit plugin {self.settings.plugin} not found.")
149149

150-
self.log.info("## Run deposit plugin")
150+
self.log.info(f"## Run deposit plugin {plugin_name}")
151151
# run plugin
152152
try:
153153
plugin_func(self)

src/hermes/commands/harvest/base.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ def __call__(self, args: argparse.Namespace) -> None:
4040
self.log.info("# Metadata harvesting")
4141
self.args = args
4242

43+
if len(self.settings.sources) == 0:
44+
self.log.info("# No plugin was configured to be run and loaded.")
45+
4346
# Initialize the harvest cache directory here to indicate the step ran
4447
ctx = HermesContext()
4548
ctx.prepare_step('harvest')

test/hermes_test/commands/deposit/test_invenio_e2e.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def sandbox_auth():
3737
"http://schema.org/familyName": [{"@value": "Test"}],
3838
"http://schema.org/givenName": [{"@value": "Testi"}]
3939
}],
40-
"http://schema.org/license": [{"@id": "https://spdx.org/licenses/Apache-2.0"}]
40+
"http://schema.org/license": ["https://spdx.org/licenses/Apache-2.0"]
4141
}),
4242
{
4343
"upload_type": "software",

test/hermes_test/commands/init/test_init.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import json
88
import pytest
99

10-
pytest.skip("FIXME: Re-enable test after data model refactoring is done.", allow_module_level=True)
11-
1210
from hermes.commands.init.base import string_in_file, download_file_from_url
1311
from unittest.mock import patch, MagicMock
1412
import hermes.commands.init.util.oauth_process as oauth_process

test/hermes_test/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import os
88
import shutil
99
import subprocess
10+
import sys
1011

1112
import pytest
1213

@@ -33,7 +34,7 @@ def __enter__(self):
3334

3435
def run(self, *args):
3536
proc = subprocess.Popen(
36-
[self.hermes_exe, *args], stdout=subprocess.PIPE, stderr=subprocess.PIPE
37+
[sys.executable, "-m", self.hermes_exe, *args], stdout=subprocess.PIPE, stderr=subprocess.PIPE
3738
)
3839
proc.wait()
3940
return proc

test/hermes_test/test_cli.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
import pytest
1010

11-
pytest.skip("FIXME: Re-enable test after data model refactoring is done.", allow_module_level=True)
12-
1311
from hermes.commands import cli
1412

1513

@@ -34,6 +32,5 @@ def test_hermes_process(hermes_env):
3432

3533
with hermes_env:
3634
result = hermes_env.run("process")
37-
print(result.stdout.read())
3835

3936
assert result.returncode == 0

test/hermes_test/test_main.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66

77
# flake8: noqa
88

9-
import pytest
10-
11-
pytest.skip("FIXME: Re-enable test after data model refactoring is done.", allow_module_level=True)
12-
139
import subprocess
1410
import sys
1511

0 commit comments

Comments
 (0)