Message136168
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. |
|
Date |
User |
Action |
Args |
2011-05-17 17:04:08 | r.david.murray | set | recipients:
+ r.david.murray, eric.araujo, rmstoi |
2011-05-17 17:04:07 | r.david.murray | set | messageid: <1305651847.94.0.968134180187.issue12009@psf.upfronthosting.co.za> |
2011-05-17 17:04:07 | r.david.murray | link | issue12009 messages |
2011-05-17 17:04:07 | r.david.murray | create | |
|