Commits

Arve Knudsen  committed 1edb617

Adhere to nose2 style

  • Participants
  • Parent commits 32f0393
  • Branches test-testid

Comments (0)

Files changed (2)

File nose2/plugins/testid.py

         the test's real ID. In this way, tests can be referred to via sequential
         numbers.
         """
-        test_id = self.__real_id_from_id(event.name)
+        test_id = self._testNameFromId(event.name)
         if test_id is not None:
             event.name = test_id
 
         """Implement hook."""
         new_names = []
         for i, name in enumerate(event.names[:]):
-            test_id = self.__real_id_from_id(name)
+            test_id = self._testNameFromId(name)
             if test_id is not None:
                 event.names[i] = test_id
 
         self._loaded = True
 
 
-    def __real_id_from_id(self, name):
+    def _testNameFromId(self, name):
         """Try to translate one of our IDs to real test ID."""
         m = self.idpat.match(name)
         if m is None:

File nose2/tests/test_testid_plugin.py

 
     def setUp(self):
         super(UnitTestTestId, self).setUp()
-        self.__orig_dir = os.getcwd()
+        self._orig_dir = os.getcwd()
         # XXX: Use deterministic temporary directory, which can be inspected
         # after test?
-        self.__temp_dir = tempfile.mkdtemp()
-        os.chdir(self.__temp_dir)
+        self._temp_dir = tempfile.mkdtemp()
+        os.chdir(self._temp_dir)
 
     def tearDown(self):
         super(UnitTestTestId, self).tearDown()
-        os.chdir(self.__orig_dir)
-        shutil.rmtree(self.__temp_dir, ignore_errors=True)
+        os.chdir(self._orig_dir)
+        shutil.rmtree(self._temp_dir, ignore_errors=True)
 
 
     def test___init__(self):
         """Test the __init__ method."""
-        plug = self.__create()
+        plug = self._create()
         # Test attributes
         for name, exp_val in [('configSection', 'testid'), ('commandLineSwitch',
             ('I', 'with-id', 'Add test ids to output')), ('idfile',
     def test_start_test(self):
         """Test startTest method."""
         event = FakeStartTestEvent(self)
-        plug = self.__create()
+        plug = self._create()
         plug.startTest(event)
 
         self.assertEqual(plug.id, 1)
     def test_start_test_twice(self):
         """Test calling startTest twice."""
         event = FakeStartTestEvent(self)
-        plug = self.__create()
+        plug = self._create()
         plug.startTest(event)
         plug.startTest(event)
 
 
     def test_stop_test_run(self):
         """Test stopTestRun method."""
-        plug = self.__create()
+        plug = self._create()
         plug.startTest(FakeStartTestEvent(self))
         plug.stopTestRun(None)
 
 
     def test_load_tests_from_name(self):
         """Test loadTestsFromName method."""
-        plug = self.__create()
+        plug = self._create()
         # By first starting/stopping a test, an ID is assigned by the plugin
         plug.startTest(FakeStartTestEvent(self))
         plug.stopTestRun(None)
 
     def test_load_tests_from_name_no_ids(self):
         """Test calling loadTestsFromName when no IDs have been saved."""
-        plug = self.__create()
+        plug = self._create()
         event = FakeLoadFromNameEvent('1')
         plug.loadTestsFromName(event)
 
 
     def test_load_tests_from_names(self):
         """Test loadTestsFromNames method."""
-        plug = self.__create()
+        plug = self._create()
         # By first starting/stopping a test, an ID is assigned by the plugin
         plug.startTest(FakeStartTestEvent(self))
         plug.stopTestRun(None)
         self.assertEqual(name2, '2')
 
 
-    def __create(self):
+    def _create(self):
         """Create a TestId instance."""
         return testid.TestId()