R. David Murray <[email protected]> added the comment:
With these new additions, the test input is getting unwieldy. If you have the
time, I'd like to see the unit tests refactored to be more unit-testy. That
is, instead of a single test netrc file, have multiple inputs, one for each
thing being tested, and turn setUp into a factory function that each test calls:
def make_nrc (self, test_data):
mode = 'w'
if sys.platform not in ['cygwin']:
mode += 't'
fp = open(temp_filename, mode)
fp.write(test_data)
fp.close()
return netrc.netrc(temp_filename)
You can also use textwrap.dedent to embed the test_string in the call to
make_nrc in the test method in a pretty fashion:
def test_default_login(self):
nrc = self.make_nrc(textwrap.dedent("""\
default login log2 password pass2
""")
self.assertEqual(self.nrc.hosts['default'], ('log2', None, 'pass2'))
If you don't have time to do this I'll do it at some point (not sure when).
I haven't looked at your fix in detail because the unit tests don't currently
isolate the issues, but it looks to like it is the right approach.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue12009>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com