[Freeipa-devel] [PATCH 0001] Test Topology plugin is listed among DS plugins

Martin Basti mbasti at redhat.com
Mon Jul 20 10:46:58 UTC 2015


On 20/07/15 11:57, Oleg Fayans wrote:
> +        pwfile = api.env.dot_ipa + os.sep + ".dmpw"
> +        if ipautil.file_exists(pwfile):
> +            fp = open(pwfile, "r")
> +            dm_password = fp.read().rstrip()
> +            fp.close()
> +        else:
Hello,

1) Can you use os.path.join() instead of "+ os.sep +" please

2) Can you use with statement with file?

with open(pwfile, "r") as f:
     dm_password = f.read().rstrip()

3) Please keep PEP8 in new code

./ipatests/test_ipaserver/test_topology_plugin.py:30:80: E501 line too 
long (102 > 79 characters)
./ipatests/test_ipaserver/test_topology_plugin.py:33:80: E501 line too 
long (92 > 79 characters)
./ipatests/test_ipaserver/test_topology_plugin.py:39:80: E501 line too 
long (124 > 79 characters)
./ipatests/test_ipaserver/test_topology_plugin.py:44:80: E501 line too 
long (92 > 79 characters)
./ipatests/test_ipaserver/test_topology_plugin.py:45:48: E128 
continuation line under-indented for visual indent
./ipatests/test_ipaserver/test_topology_plugin.py:45:80: E501 line too 
long (89 > 79 characters)
./ipatests/test_ipaserver/test_topology_plugin.py:46:48: E128 
continuation line under-indented for visual indent
./ipatests/test_ipaserver/test_topology_plugin.py:46:80: E501 line too 
long (89 > 79 characters)
./ipatests/test_ipaserver/test_topology_plugin.py:58:80: E501 line too 
long (87 > 79 characters)

4) Missing nose import
             raise nose.SkipTest("No directory manager password in %s" % 
pwfile)

5) Can you use sets here instead of sorted lists?
assert(sorted(entry.keys()) == sorted(pluginattrs.keys()))


Martin^2

-- 
Martin Basti




More information about the Freeipa-devel mailing list