Skip to content

Commit 0f77d53

Browse files
authored
Merge pull request #66 from pytest-dev/fix_missing_fields
Pair all fields in the setup with those used in test_cases
2 parents 6f7d0fb + 5590294 commit 0f77d53

15 files changed

Lines changed: 49 additions & 44 deletions

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 1.0.3 (20th October 2022)
4+
5+
* Fixes bug when used with xdist extension by @tonybaloney in https://github.com/pytest-dev/pytest-nunit/pull/66
6+
37
## 1.0.2 (19th October 2022)
48

59
* Don't assert that call-report exists before checking value of attribute by @tonybaloney in https://github.com/pytest-dev/pytest-nunit/pull/63

ext/generate-models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
Written by Anthony Shaw.
88
"""
99

10+
import keyword
1011
import logging
12+
1113
import xmlschema
1214
import xmlschema.qnames
13-
import keyword
1415

1516
try:
1617
import black

pytest_nunit/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.0.2"
1+
__version__ = "1.0.3"

pytest_nunit/attrs2xml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import enum
12
import xml.etree.ElementTree as ET
23
from xml.sax.saxutils import escape
3-
import enum
44

55

66
class CdataComment(ET.Element):

pytest_nunit/models/nunit.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import attr
21
import enum
32

3+
import attr
4+
45

56
class TestDurationType(float):
67
pass

pytest_nunit/nunit.py

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,18 @@
1-
import sys
2-
import os
1+
import getpass
32
import locale
3+
import os
44
import platform
5-
import getpass
6-
from .models.nunit import (
7-
TestRunType,
8-
TestResultType,
9-
TestCaseElementType,
10-
TestSuiteElementType,
11-
TestStatusType,
12-
TestRunStateType,
13-
TestSuiteTypeType,
14-
PropertyBagType,
15-
PropertyType,
16-
EnvironmentType,
17-
AttachmentsType,
18-
AttachmentType,
19-
ReasonType,
20-
FailureType,
21-
TestFilterType,
22-
ValueMatchFilterType,
23-
)
24-
from .attrs2xml import AttrsXmlRenderer, CdataComment
5+
import sys
6+
257
from _pytest._code.code import ExceptionChainRepr
268

9+
from .attrs2xml import AttrsXmlRenderer, CdataComment
10+
from .models.nunit import (AttachmentsType, AttachmentType, EnvironmentType,
11+
FailureType, PropertyBagType, PropertyType,
12+
ReasonType, TestCaseElementType, TestFilterType,
13+
TestResultType, TestRunStateType, TestRunType,
14+
TestStatusType, TestSuiteElementType,
15+
TestSuiteTypeType, ValueMatchFilterType)
2716

2817
FRAMEWORK_VERSION = "3.6.2" # Nunit version this was based on
2918
CLR_VERSION = sys.version

pytest_nunit/plugin.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@
55
66
Shares the same pattern of CLI options for ease of use.
77
"""
8-
from _pytest.config import filename_arg
9-
10-
from io import open
8+
import functools
9+
import logging
1110
import os
1211
import sys
12+
from collections import Counter, defaultdict, namedtuple
1313
from datetime import datetime
14-
import functools
15-
from collections import namedtuple, defaultdict, Counter
16-
17-
from .nunit import NunitTestRun
14+
from io import open
1815

19-
import logging
2016
import pytest
17+
from _pytest.config import filename_arg
18+
19+
from .nunit import NunitTestRun
2120

2221
log = logging.getLogger(__name__)
2322

@@ -147,9 +146,13 @@ def record_testreport(self, testreport):
147146
"error": "",
148147
"stack-trace": "",
149148
"name": self.nunit_xml.prefix + testreport.nodeid,
149+
"reason": "",
150+
"outcome": "",
150151
}
151152
self.nunit_xml.idrefindex += 1 # Inc. node id ref counter
152153
r["start"] = datetime.utcnow() # Will be overridden if called
154+
r["stop"] = datetime.utcnow() # Will be overridden if called
155+
r["duration"] = 0 # Updated on teardown
153156
if testreport.outcome == "skipped":
154157
log.debug("skipping : {0}".format(testreport.longrepr))
155158
if (

setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
import os
54
import codecs
6-
from setuptools import find_packages
7-
from setuptools import setup
5+
import os
6+
7+
from setuptools import find_packages, setup
88

99

1010
def read(fname):
@@ -16,7 +16,7 @@ def getversion():
1616
if 'BUILD_VERSION' in os.environ:
1717
return os.environ['BUILD_VERSION']
1818
else:
19-
return "1.0.2"
19+
return "1.0.3"
2020

2121

2222
setup(
@@ -42,7 +42,7 @@ def getversion():
4242
],
4343
},
4444
classifiers=[
45-
'Development Status :: 4 - Beta',
45+
'Development Status :: 5 - Production/Stable',
4646
'Framework :: Pytest',
4747
'Intended Audience :: Developers',
4848
'Topic :: Software Development :: Testing',

tests/integration/test_azure.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44

55
import os
6+
67
import pytest
78

89

tests/integration/test_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
23
import xmlschema
34

45

0 commit comments

Comments
 (0)