Example #1
0
    def test_create_should_return_a_result_with_a_parsed_node(
            self, report, pattern_config):
        result = Result.create(report, pattern_config)

        assert isinstance(result, Result)
        assert result.outcome == report.outcome
        assert result.node == Node.parse(report.nodeid, pattern_config)
Example #2
0
    def test_parse_should_parse_node_id_attributes(self, pattern_config):
        nodeid = 'tests/test_module.py::test_title'
        node = Node.parse(nodeid, pattern_config)

        assert node.title == formatters.format_title('test_title',
                                                     pattern_config.functions)
        assert node.module_name == (formatters.format_module_name(
            'tests/test_module.py', pattern_config.files))
Example #3
0
    def test_parse_should_use_overridden_attribute_instead_of_parse_node_id(
            self, attribute, value, pattern_config):
        nodeid = 'tests/test_module.py::test_title'

        node = Node.parse(nodeid, pattern_config, **{attribute: value})

        result = getattr(node, attribute)

        assert result == formatters.format_multi_line_text(value)
Example #4
0
    def test_create_should_call_parse_with_overridden_attributes(
            self, report_attribute, parameter, value, report, pattern_config):
        setattr(report, report_attribute, value)

        result = Result.create(report, pattern_config)

        kwargs = {parameter: value}

        assert result.node == Node.parse(nodeid=report.nodeid,
                                         pattern_config=pattern_config,
                                         **kwargs)
Example #5
0
    def test_parse_with_class_name(self, pattern_config, nodeid, class_name):
        node = Node.parse(nodeid, pattern_config)

        assert node.class_name == class_name
Example #6
0
    def test_parse_should_return_a_node_instance(self, pattern_config):
        nodeid = 'tests/test_module.py::test_title'
        node = Node.parse(nodeid, pattern_config)

        assert isinstance(node, Node)