joseph-roitman / pytest-snapshot

A plugin for snapshot testing with pytest.
MIT License
117 stars 12 forks source link

Broken with pytest 6.0.1 #18

Closed shughes-uk closed 4 years ago

shughes-uk commented 4 years ago

Throws an exception

node = <Function test_auth>

    def get_default_snapshot_dir(node):
        """
        Returns the default snapshot directory for the pytest test.

        :type node: _pytest.python.Function
        :rtype: Path
        """
        test_module_dir = node.fspath.dirpath()
        test_module = node.fspath.purebasename
        if node.originalname is None:
            test_name = node.name
            parametrize_name = None
        else:
            test_name = node.originalname
            parametrize_match = PARAMETRIZED_TEST_REGEX.match(node.name)
>           assert parametrize_match is not None, 'Expected request.node.name to be of format TEST_FUNCTION[PARAMS]'
E           AssertionError: Expected request.node.name to be of format TEST_FUNCTION[PARAMS]
E           assert None is not None
joseph-roitman commented 4 years ago

Thanks for the update, in v6.0 pytest made an internal change to the behavior of originalname which broke the function.

shughes-uk commented 4 years ago

thanks for the quick turnaround!