Page MenuHomeSoftware Heritage

Write tests for swh/journal/writer/inmemory.py
Closed, MigratedEdits Locked

Description

It's low priority because it's only used in tests of other components.

But we should have tests for this module as well (eg. to check for D4621)

Event Timeline

vlorentz created this task.

Hey @vlorentz
How do I check https://forge.softwareheritage.org/source/swh-journal/browse/master/swh/journal/writer/inmemory.py$31. Do I have to pass dummy content, raw_extrinsic_metadata, origin_visit, et cetera as the object_ to write_addition function and before passing verify if they have unique_key function implemented ?

Pass an object without `unique_key` and check it does raise an exception

Do you some more tests or this task can be declared as resolved?

If we replaced the whole code with just this:

class InMemoryJournalWriter(Generic[TValue]):
    def __init__(self, value_sanitizer: Any):
        pass

    def write_addition(self, *args):
        raise NotImplementedError()

would still pass. So yes, it needs more tests.

vlorentz assigned this task to KShivendu.

I think so, thanks