Skip to content

Commit

Permalink
Merge pull request #20 from renanivo/minor-fixes
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
renanivo authored Mar 6, 2019
2 parents ec544f3 + cf955d1 commit c33cf7c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ install: ## Install package for development
@pip install -r requirements-dev.txt

test:
@py.test tests/ --cov pytest_testdox --cov-report=xml
@pytest tests/ --cov pytest_testdox --cov-report=xml

check: ## Run static code checks
isort --check
Expand Down
2 changes: 1 addition & 1 deletion pytest_testdox/formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def _remove_patterns(statement, patterns):
pattern = '{0}$'.format(pattern)
statement = re.sub(pattern, '', statement)

elif glob_pattern.endswith('*'):
elif glob_pattern.endswith('*'):
pattern = '^{0}'.format(pattern)
statement = re.sub(pattern, '', statement)

Expand Down
11 changes: 7 additions & 4 deletions pytest_testdox/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@ def parse(cls, nodeid, pattern_config):
pattern_config.files
)

class_name = node_parts[-2]
if '()' not in class_name:
class_name = None
else:
class_name = None
if '()' in node_parts[-2]:
class_name = formatters.format_class_name(
node_parts[-3],
pattern_config.classes
)
elif len(node_parts) > 2:
class_name = formatters.format_class_name(
node_parts[-2],
pattern_config.classes
)

return cls(title=title, class_name=class_name, module_name=module_name)

Expand Down
5 changes: 4 additions & 1 deletion pytest_testdox/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ def _register_stats(self, report):
Originally from:
https://github.com/pytest-dev/pytest/blob/47a2a77/_pytest/terminal.py#L198-L201
"""
res = self.config.hook.pytest_report_teststatus(report=report)
res = self.config.hook.pytest_report_teststatus(
report=report,
config=self.config
)
category = res[0]
self.stats.setdefault(category, []).append(report)
self._tests_ran = True
Expand Down
4 changes: 4 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def test_parse_should_parse_node_id_attributes(self, pattern_config):
(
'tests/test_module.py::TestClassName::()::test_title',
formatters.format_class_name('TestClassName', ['Test*'])
),
(
'tests/test_module.py::TestClassName::test_title',
formatters.format_class_name('TestClassName', ['Test*'])
)
))
def test_parse_with_class_name(self, pattern_config, nodeid, class_name):
Expand Down

0 comments on commit c33cf7c

Please sign in to comment.