dirsrvtests/create_test.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
New commits:
commit 9fcfb6c9d14f25d595f75025a45cb3db38a85965
Author: Simon Pichugin <spichugi(a)redhat.com>
Date: Mon Jan 16 13:47:41 2017 +0100
Ticket 49085 - Make a short topology fixture alias
Description: Modify create_test.py, so it will insert "topo" import alias
instead of long topology names like "topology_m1h1c1".
With it we have more readable code - 'topo.ms["master1"]'.
https://fedorahosted.org/389/ticket/49085
Reviewed by: mreynolds (Thanks!)
diff --git a/dirsrvtests/create_test.py b/dirsrvtests/create_test.py
index 4c2876e..d898397 100755
--- a/dirsrvtests/create_test.py
+++ b/dirsrvtests/create_test.py
@@ -212,7 +212,7 @@ if len(sys.argv) > 0:
# Write the imports
if my_topology[0]:
- topology_import = 'from lib389.topologies import
{}\n'.format(my_topology[1])
+ topology_import = 'from lib389.topologies import {} as
topo\n'.format(my_topology[1])
else:
topology_import = ''
@@ -287,7 +287,7 @@ if len(sys.argv) > 0:
# Write the 'topology function'
TEST.write('(a)pytest.fixture(scope="module")\n')
- TEST.write('def {}(request):\n'.format(my_topology[1]))
+ TEST.write('def topo(request):\n')
if repl_deployment:
TEST.write(' """Create Replication
Deployment"""\n')
@@ -656,14 +656,14 @@ if len(sys.argv) > 0:
# Write the test function
if ticket:
- TEST.write('def test_ticket{}({}):\n'.format(ticket, my_topology[1]))
+ TEST.write('def test_ticket{}(topo):\n'.format(ticket))
TEST.write(' """Write your testcase here...\n\n')
TEST.write(' Also, if you need any testcase initialization,\n')
TEST.write(' please, write additional fixture for that' +
'(include finalizer).\n')
TEST.write(' """\n\n')
else:
- TEST.write('def test_something({}):\n'.format(my_topology[1]))
+ TEST.write('def test_something(topo):\n')
TEST.write(' """Write a single test here...\n\n')
TEST.write(' Also, if you need any test suite initialization,\n')
TEST.write(' please, write additional fixture for that (including
finalizer).\n'