Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nxdtest
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
nxdtest
Commits
f91a050d
Commit
f91a050d
authored
Oct 20, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start of tests
Verify pytest summary-parsing functionality.
parent
f74005e4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
129 additions
and
3 deletions
+129
-3
nxdtest/__init__.py
nxdtest/__init__.py
+3
-3
nxdtest/nxdtest_pytest_test.py
nxdtest/nxdtest_pytest_test.py
+123
-0
setup.py
setup.py
+3
-0
No files found.
nxdtest/__init__.py
View file @
f91a050d
...
...
@@ -248,7 +248,7 @@ def main():
}
tres
.
update
(
status
)
print
(
test_result_summary
(
t
.
name
,
tres
))
print
(
_
test_result_summary
(
t
.
name
,
tres
))
test_result_line
.
stop
(
**
tres
)
# tee, similar to tee(1) utility, copies data from fin to fout appending them to buf.
...
...
@@ -270,10 +270,10 @@ def tee(fin, fout, buf):
buf
.
append
(
data
)
# test_result_summary returns one-line summary for test result.
#
_
test_result_summary returns one-line summary for test result.
# it returns something like 'ok # 100t 3f'
# **kw is what is passed to test_result_line.stop().
def
test_result_summary
(
name
,
kw
):
def
_
test_result_summary
(
name
,
kw
):
def
v
(
name
):
return
kw
.
get
(
name
,
'?'
)
...
...
nxdtest/nxdtest_pytest_test.py
0 → 100644
View file @
f91a050d
# -*- coding: utf-8 -*-
# Copyright (C) 2020 Nexedi SA and Contributors.
#
# This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your
# option) any later version, as published by the Free Software Foundation.
#
# You can also Link and Combine this program with other software covered by
# the terms of any of the Free Software licenses or any of the Open Source
# Initiative approved licenses and Convey the resulting work. Corresponding
# source of such a combination shall include the source code for all other
# software used.
#
# This program is distributed WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options.
# verify pytest-related functionality
from
nxdtest
import
_test_result_summary
,
PyTest
import
pytest
# [] of (name, textout, summaryok)
testv
=
[]
def
case1
(
name
,
textout
,
summaryok
):
testv
.
append
((
name
,
textout
,
summaryok
))
case1
(
'ok+xfail'
,
"""
\
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-4.6.11, py-1.9.0, pluggy-0.13.1
rootdir: /srv/slapgrid/slappart9/srv/testnode/dfq/soft/46d349541123ed5fc6ceea58fd013a51/parts/zodbtools-dev
collected 43 items
zodbtools/test/test_analyze.py . [ 2%]
zodbtools/test/test_commit.py .x [ 6%]
zodbtools/test/test_dump.py .x. [ 13%]
zodbtools/test/test_tidrange.py ............................. [ 81%]
zodbtools/test/test_zodb.py ........ [100%]
=============== 41 passed, 2 xfailed, 1 warnings in 4.62 seconds ===============
"""
,
'?
\
t
testname
\
t
1.000s
\
t
# 43t ?e ?f ?s'
)
case1
(
'ok+fail'
,
"""
\
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-4.6.11, py-1.9.0, pluggy-0.13.1
rootdir: /srv/slapgrid/slappart16/srv/testnode/dfj/soft/8b9988ce0aa31334c6bd56b40e4bba65/parts/pygolang-dev
collected 112 items
golang/_gopath_test.py .. [ 1%]
golang/context_test.py .. [ 3%]
golang/cxx_test.py .. [ 5%]
golang/errors_test.py ........ [ 12%]
golang/fmt_test.py ... [ 15%]
golang/golang_test.py ................................................ [ 58%]
golang/io_test.py . [ 58%]
golang/strconv_test.py .. [ 60%]
golang/strings_test.py ..... [ 65%]
golang/sync_test.py ............. [ 76%]
golang/time_test.py ...F.... [ 83%]
golang/pyx/build_test.py ... [ 86%]
golang/pyx/runtime_test.py . [ 87%]
gpython/gpython_test.py ssssss.sssssss [100%]
=================================== FAILURES ===================================
__________________________________ test_timer __________________________________
def test_timer():
# start timers at x5, x7 and x11 intervals an verify that the timers fire
# in expected sequence. The times when the timers fire do not overlap in
# checked range because intervals are prime and chosen so that they start
# overlapping only after 35 (=5·7).
tv = [] # timer events
Tstart = time.now()
t23 = time.Timer(23*dt)
t5 = time.Timer( 5*dt)
def _():
tv.append(7)
t7f.reset(7*dt)
t7f = time.Timer( 7*dt, f=_)
tx11 = time.Ticker(11*dt)
while 1:
_, _rx = select(
t23.c.recv, # 0
t5 .c.recv, # 1
t7f.c.recv, # 2
tx11.c.recv, # 3
)
if _ == 0:
tv.append(23)
break
if _ == 1:
tv.append(5)
t5.reset(5*dt)
if _ == 2:
assert False, "t7f sent to channel; must only call func"
if _ == 3:
tv.append(11)
Tend = time.now()
assert (Tend - Tstart) >= 23*dt
> assert tv == [ 5, 7, 5, 11, 7, 5, 5, 7,11,23]
E assert [5, 7, 5, 11, 5, 7, ...] == [5, 7, 5, 11, 7, 5, ...]
E At index 4 diff: 5 != 7
E Use -v to get the full diff
golang/time_test.py:106: AssertionError
=============== 1 failed, 98 passed, 13 skipped in 26.85 seconds ===============
"""
,
'?
\
t
testname
\
t
1.000s
\
t
# 112t ?e 1f 13s'
)
@
pytest
.
mark
.
parametrize
(
"name,textout,summaryok"
,
testv
)
def
test_pytest_summary
(
name
,
textout
,
summaryok
):
kw
=
{
'duration'
:
1.0
}
kw
.
update
(
PyTest
.
summary
(
textout
))
summary
=
_test_result_summary
(
'testname'
,
kw
)
assert
summary
==
summaryok
setup.py
View file @
f91a050d
...
...
@@ -14,6 +14,9 @@ setup(
packages
=
find_packages
(),
install_requires
=
[
'erp5.util'
,
'six'
],
extras_require
=
{
'test'
:
[
'pytest'
],
},
entry_points
=
{
'console_scripts'
:
[
'nxdtest = nxdtest:main'
]},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment