Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Network Health
sbws
Commits
91844fbf
Commit
91844fbf
authored
Jun 10, 2018
by
juga
Browse files
Recover datadir fixture needed for v3bwfile tests
parent
7d69bc7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/unit/conftest.py
View file @
91844fbf
...
...
@@ -27,6 +27,29 @@ class _PseudoArguments(argparse.Namespace):
setattr
(
self
,
key
,
kw
[
key
])
@
pytest
.
fixture
()
def
datadir
(
request
):
""" get, read, open test files from the "data" directory. """
class
D
:
def
__init__
(
self
,
basepath
):
self
.
basepath
=
basepath
def
open
(
self
,
name
,
mode
=
"r"
):
return
self
.
basepath
.
join
(
name
).
open
(
mode
)
def
join
(
self
,
name
):
return
self
.
basepath
.
join
(
name
).
strpath
def
read
(
self
,
name
):
with
self
.
open
(
name
,
"r"
)
as
f
:
return
f
.
read
()
def
readlines
(
self
,
name
):
with
self
.
open
(
name
,
"r"
)
as
f
:
return
f
.
readlines
()
return
D
(
request
.
fspath
.
dirpath
(
"data"
))
@
pytest
.
fixture
(
scope
=
'session'
)
def
parser
():
return
create_parser
()
...
...
Write
Preview
Supports
Markdown
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