moin icon indicating copy to clipboard operation
moin copied to clipboard

create tests for cli

Open bylsmad opened this issue 2 years ago • 4 comments

working on pytests for cli in order to have confidence I'm not breaking anything while fixing #1378

bylsmad avatar Apr 03 '23 12:04 bylsmad

Sounds great. You can raise a PR if you have the first test module available. Maybe I can support with some tests. Please be aware that moin dump-html is still broken, that's one of the open topics from #729. Any help is appreciated.

UlrichB22 avatar Apr 03 '23 20:04 UlrichB22

@UlrichB22 pull req #1389 is up, let's coordinate here by posting a comment when we start on a test for a command so we don't duplicate...I'm planning to turn back to #1378 for the time being as I believe the tests I need for it are in place

bylsmad avatar Apr 03 '23 22:04 bylsmad

If you use MOINLOGGINGCONF to apply special logging options and turn debug on some tests will fail. E.g. pytest src/moin/cli/_tests/test_modify_item.py reports

    def read_index_dump_latest_revs(out: str):
        """parse output of moin dump-index yielding the items in latest revs
    
        :param out: stdout of `moin index-dump --no-truncate` command
        :return: list of dicts with key value pairs from output"""
        [...]
            space_index = line.index(' ')
>           item[line[0:space_index]] = eval(line[space_index + 1:])
E             File "<string>", line 1
E               moin.log:138 using logging configuration read from "/home/moint03/test/moin/logging.conf"
E                       ^
E           SyntaxError: invalid syntax

/home/moint03/test/moin/src/moin/cli/_tests/__init__.py:53: SyntaxError

UlrichB22 avatar Apr 15 '23 17:04 UlrichB22

@UlrichB22 I will fix the issue with MOINLOGGINGCONF, filed it as #1409

bylsmad avatar Apr 17 '23 23:04 bylsmad