コード例 #1
0
ファイル: test_loader.py プロジェクト: RootForum/magrathea
    def test_04(self):
        """
        Test Case 04:
        Detect non-existing classes in a non-existing test environment.

        Test is passed if the returned dictionary matches with the expected result.
        """
        expected = {}
        result = detect_class_modules('this_hopefully_does_not_exist', TestCase)
        self.assertDictEqual(expected, result)
コード例 #2
0
ファイル: test_loader.py プロジェクト: RootForum/magrathea
    def test_03(self):
        """
        Test Case 03:
        Detect non-existing classes in an existing artificial package test environment.

        Test is passed if the returned dictionary matches with the expected result.
        """
        expected = {}
        td = tempfile.mkdtemp()
        construct_package('loader_test03', td)
        sys.path.insert(0, td)
        result = detect_class_modules('loader_test03', TestCase)
        sys.path.remove(td)
        shutil.rmtree(td)
        self.assertDictEqual(expected, result)
コード例 #3
0
ファイル: test_loader.py プロジェクト: RootForum/magrathea
    def test_01(self):
        """
        Test Case 01:
        Detect existing classes in an existing artificial package test environment.

        Test is passed if the returned dictionary matches with the expected result.
        """
        expected = {
            'TestOne': 'loader_test01.test_module0',
            'TestTwo': 'loader_test01.test_module1'
        }
        from argparse import ArgumentParser
        td = tempfile.mkdtemp()
        construct_package('loader_test01', td)
        sys.path.insert(0, td)
        result = detect_class_modules('loader_test01', ArgumentParser)
        sys.path.remove(td)
        shutil.rmtree(td)
        self.assertDictEqual(expected, result)