forked from man-group/pytest-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpytest_svn.py
35 lines (28 loc) · 803 Bytes
/
pytest_svn.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
""" Repository fixtures
"""
import pytest
from pytest_shutil.workspace import Workspace
@pytest.yield_fixture()
def svn_repo():
""" Function-scoped fixture to create a new svn repo in a temporary workspace.
Attributes
----------
uri (str) : SVN repo uri.
.. also inherits all attributes from the `workspace` fixture
"""
repo = SVNRepo()
yield repo
repo.teardown()
class SVNRepo(Workspace):
"""
Creates an empty SVN repository in a temporary workspace.
Cleans up on exit.
Attributes
----------
uri : `str`
repository base uri
"""
def __init__(self):
super(SVNRepo, self).__init__()
self.run('svnadmin create .', capture=True)
self.uri = "file://%s" % self.workspace