Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
5a8d1254
Commit
5a8d1254
authored
Nov 09, 2018
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let other files be relative to the test package too.
parent
336c395f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
src/gevent/testing/testrunner.py
src/gevent/testing/testrunner.py
+17
-14
No files found.
src/gevent/testing/testrunner.py
View file @
5a8d1254
...
...
@@ -112,6 +112,18 @@ if PYPY:
'test__greenletset.py'
]
def
_package_relative_filename
(
filename
,
package
):
if
not
os
.
path
.
isfile
(
filename
)
and
package
:
# Ok, try to locate it as a module in the package
package_dir
=
_dir_from_package_name
(
package
)
return
os
.
path
.
join
(
package_dir
,
filename
)
return
filename
def
_dir_from_package_name
(
package
):
package_mod
=
importlib
.
import_module
(
package
)
package_dir
=
os
.
path
.
dirname
(
package_mod
.
__file__
)
return
package_dir
def
run_many
(
tests
,
configured_failing_tests
=
(),
failfast
=
False
,
quiet
=
False
):
# pylint:disable=too-many-locals,too-many-statements
...
...
@@ -200,22 +212,17 @@ def run_many(tests, configured_failing_tests=(), failfast=False, quiet=False):
report
(
total
,
failed
,
passed
,
took
=
time
.
time
()
-
start
,
configured_failing_tests
=
configured_failing_tests
)
def
_dir_from_package_name
(
package
):
package_mod
=
importlib
.
import_module
(
package
)
package_dir
=
os
.
path
.
dirname
(
package_mod
.
__file__
)
return
package_dir
def
discover
(
tests
=
None
,
ignore_files
=
None
,
ignored
=
(),
coverage
=
False
,
package
=
None
):
# pylint:disable=too-many-locals,too-many-branches
olddir
=
os
.
getcwd
()
ignore
=
set
(
ignored
or
())
if
ignore_files
:
ignore_files
=
ignore_files
.
split
(
','
)
for
f
in
ignore_files
:
ignore
.
update
(
set
(
load_list_from_file
(
f
)))
ignore
.
update
(
set
(
load_list_from_file
(
f
,
package
)))
if
coverage
:
ignore
.
update
(
IGNORE_COVERAGE
)
...
...
@@ -283,11 +290,10 @@ def discover(tests=None, ignore_files=None,
def
remove_options
(
lst
):
return
[
x
for
x
in
lst
if
x
and
not
x
.
startswith
(
'-'
)]
def
load_list_from_file
(
filename
):
def
load_list_from_file
(
filename
,
package
):
result
=
[]
if
filename
:
with
open
(
filename
)
as
f
:
with
open
(
_package_relative_filename
(
filename
,
package
)
)
as
f
:
for
x
in
f
:
x
=
x
.
split
(
'#'
,
1
)[
0
].
strip
()
if
x
:
...
...
@@ -459,10 +465,7 @@ def main():
if
options
.
config
:
config
=
{}
if
not
os
.
path
.
isfile
(
options
.
config
)
and
options
.
package
:
# Ok, try to locate it as a module in the package
package_dir
=
_dir_from_package_name
(
options
.
package
)
options
.
config
=
os
.
path
.
join
(
package_dir
,
options
.
config
)
options
.
config
=
_package_relative_filename
(
options
.
config
,
options
.
package
)
with
open
(
options
.
config
)
as
f
:
config_data
=
f
.
read
()
six
.
exec_
(
config_data
,
config
)
...
...
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