This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients eric.araujo, r.david.murray, rmstoi
Date 2011-05-17.17:04:07
SpamBayes Score 1.9919087e-08
Marked as misclassified No
Message-id <1305651847.94.0.968134180187.issue12009@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2011-05-17 17:04:08r.david.murraysetrecipients: + r.david.murray, eric.araujo, rmstoi
2011-05-17 17:04:07r.david.murraysetmessageid: <1305651847.94.0.968134180187.issue12009@psf.upfronthosting.co.za>
2011-05-17 17:04:07r.david.murraylinkissue12009 messages
2011-05-17 17:04:07r.david.murraycreate