예제 #1
0
    def test_handle_default_args(self):
        """
        Assert that the --pythonpath argument changes sys.path
        """
        parser = argparse.ArgumentParser(parents=[DefaultParser()])
        args = parser.parse_args(['--traceback', '--pythonpath', '/tmp/lib/mypy'])

        # Handle the default arguments
        handle_default_args(args)

        # Ensure that the path is modified.
        self.assertIn('/tmp/lib/mypy', sys.path)
예제 #2
0
    def test_handle_default_args(self):
        """
        Assert that the --pythonpath argument changes sys.path
        """
        parser = argparse.ArgumentParser(parents=[DefaultParser()])
        args = parser.parse_args(
            ['--traceback', '--pythonpath', '/tmp/lib/mypy'])

        # Handle the default arguments
        handle_default_args(args)

        # Ensure that the path is modified.
        self.assertIn('/tmp/lib/mypy', sys.path)
예제 #3
0
    def test_no_path_modification(self):
        """
        Ensure that sys.path remains unchanged after defaults.
        """
        parser = argparse.ArgumentParser(parents=[DefaultParser()])
        args = parser.parse_args([])

        oldpath = list(sys.path)

        # Handle the default arguments
        handle_default_args(args)

        # Ensure that the path is unmodified.
        self.assertEqual(oldpath, sys.path)
예제 #4
0
    def test_no_path_modification(self):
        """
        Ensure that sys.path remains unchanged after defaults.
        """
        parser = argparse.ArgumentParser(parents=[DefaultParser()])
        args = parser.parse_args([])

        oldpath = list(sys.path)

        # Handle the default arguments
        handle_default_args(args)

        # Ensure that the path is unmodified.
        self.assertEqual(oldpath, sys.path)