Skip to content

Commit

Permalink
Merge pull request #66 from pytest-dev/fix_missing_fields
Browse files Browse the repository at this point in the history
Pair all fields in the setup with those used in test_cases
  • Loading branch information
tonybaloney authored Oct 20, 2022
2 parents 6f7d0fb + 5590294 commit 0f77d53
Show file tree
Hide file tree
Showing 15 changed files with 49 additions and 44 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.0.3 (20th October 2022)

* Fixes bug when used with xdist extension by @tonybaloney in https://github.com/pytest-dev/pytest-nunit/pull/66

## 1.0.2 (19th October 2022)

* Don't assert that call-report exists before checking value of attribute by @tonybaloney in https://github.com/pytest-dev/pytest-nunit/pull/63
Expand Down
3 changes: 2 additions & 1 deletion ext/generate-models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
Written by Anthony Shaw.
"""

import keyword
import logging

import xmlschema
import xmlschema.qnames
import keyword

try:
import black
Expand Down
2 changes: 1 addition & 1 deletion pytest_nunit/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.0.2"
__version__ = "1.0.3"
2 changes: 1 addition & 1 deletion pytest_nunit/attrs2xml.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import enum
import xml.etree.ElementTree as ET
from xml.sax.saxutils import escape
import enum


class CdataComment(ET.Element):
Expand Down
3 changes: 2 additions & 1 deletion pytest_nunit/models/nunit.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import attr
import enum

import attr


class TestDurationType(float):
pass
Expand Down
33 changes: 11 additions & 22 deletions pytest_nunit/nunit.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,18 @@
import sys
import os
import getpass
import locale
import os
import platform
import getpass
from .models.nunit import (
TestRunType,
TestResultType,
TestCaseElementType,
TestSuiteElementType,
TestStatusType,
TestRunStateType,
TestSuiteTypeType,
PropertyBagType,
PropertyType,
EnvironmentType,
AttachmentsType,
AttachmentType,
ReasonType,
FailureType,
TestFilterType,
ValueMatchFilterType,
)
from .attrs2xml import AttrsXmlRenderer, CdataComment
import sys

from _pytest._code.code import ExceptionChainRepr

from .attrs2xml import AttrsXmlRenderer, CdataComment
from .models.nunit import (AttachmentsType, AttachmentType, EnvironmentType,
FailureType, PropertyBagType, PropertyType,
ReasonType, TestCaseElementType, TestFilterType,
TestResultType, TestRunStateType, TestRunType,
TestStatusType, TestSuiteElementType,
TestSuiteTypeType, ValueMatchFilterType)

FRAMEWORK_VERSION = "3.6.2" # Nunit version this was based on
CLR_VERSION = sys.version
Expand Down
19 changes: 11 additions & 8 deletions pytest_nunit/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@
Shares the same pattern of CLI options for ease of use.
"""
from _pytest.config import filename_arg

from io import open
import functools
import logging
import os
import sys
from collections import Counter, defaultdict, namedtuple
from datetime import datetime
import functools
from collections import namedtuple, defaultdict, Counter

from .nunit import NunitTestRun
from io import open

import logging
import pytest
from _pytest.config import filename_arg

from .nunit import NunitTestRun

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -147,9 +146,13 @@ def record_testreport(self, testreport):
"error": "",
"stack-trace": "",
"name": self.nunit_xml.prefix + testreport.nodeid,
"reason": "",
"outcome": "",
}
self.nunit_xml.idrefindex += 1 # Inc. node id ref counter
r["start"] = datetime.utcnow() # Will be overridden if called
r["stop"] = datetime.utcnow() # Will be overridden if called
r["duration"] = 0 # Updated on teardown
if testreport.outcome == "skipped":
log.debug("skipping : {0}".format(testreport.longrepr))
if (
Expand Down
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
import codecs
from setuptools import find_packages
from setuptools import setup
import os

from setuptools import find_packages, setup


def read(fname):
Expand All @@ -16,7 +16,7 @@ def getversion():
if 'BUILD_VERSION' in os.environ:
return os.environ['BUILD_VERSION']
else:
return "1.0.2"
return "1.0.3"


setup(
Expand All @@ -42,7 +42,7 @@ def getversion():
],
},
classifiers=[
'Development Status :: 4 - Beta',
'Development Status :: 5 - Production/Stable',
'Framework :: Pytest',
'Intended Audience :: Developers',
'Topic :: Software Development :: Testing',
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import os

import pytest


Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os

import xmlschema


Expand Down
3 changes: 2 additions & 1 deletion tests/integration/test_filters.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""
Test adding properties to tests
"""
import xmlschema
import os

import xmlschema


def test_keyword_filter(testdir, tmpdir):
testdir.makepyfile(
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/test_properties.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""
Test adding properties to tests
"""
import xmlschema
import os

import xmlschema


def test_basic_property(testdir, tmpdir):
"""
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
Test conversion of collected results into module reports.
"""

from datetime import datetime, timedelta

import pytest

from datetime import datetime, timedelta
from pytest_nunit.plugin import NunitXML

# This class method takes a dict of node_id->dict representing all the
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
Validate the output XML file against the schema
"""
import os
import xmlschema
from xml.etree import ElementTree

import xmlschema


def test_basic_against_reference_schema(testdir, tmpdir):
"""
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/test_tests.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""
Test various scenarios
"""
import xmlschema
import os

import xmlschema


def test_passing_test(testdir, tmpdir):
"""
Expand Down

0 comments on commit 0f77d53

Please sign in to comment.