Esempio n. 1
0
def test_host_required():
    with pytest.raises(SystemExit):
        parse_args([
            'eggs',
            '--port', '8888',
            '-m', 'spam',
        ])
Esempio n. 2
0
def test_unsupported_arg():
    with pytest.raises(SystemExit):
        parse_args([
            'eggs',
            '--port', '8888',
            '--xyz', '123',
            'spam.py',
        ])
Esempio n. 3
0
 def test_host_required(self):
     with self.assertRaises(SystemExit):
         parse_args([
             'eggs',
             '--port',
             '8888',
             '-m',
             'spam',
         ])
Esempio n. 4
0
 def test_unsupported_arg(self):
     with self.assertRaises(SystemExit):
         with captured_stdio():
             parse_args([
                 'eggs',
                 '--port', '8888',
                 '--xyz', '123',
                 'spam.py',
             ])
Esempio n. 5
0
    def test_extra_nodebug(self):
        args, extra = parse_args([
            'eggs', '--DEBUG', '--nodebug', '--port', '8888', '--vm_type',
            '???', 'spam.py', '--xyz', '123', 'abc', '--cmd-line', '--', 'foo',
            '--server', '--bar'
        ])

        self.assertEqual(
            vars(args), {
                'kind': 'script',
                'name': 'spam.py',
                'address': Address.as_client(None, 8888),
                'nodebug': True,
                'single_session': False,
                'wait': False,
            })
        self.assertEqual(
            extra,
            [
                '--DEBUG',
                '--vm_type',
                '???',
                '--',  # Expected pydevd defaults separator
                '--xyz',
                '123',
                'abc',
                '--cmd-line',
                'foo',
                '--server',
                '--bar',
            ])
Esempio n. 6
0
    def test_pseudo_backward_compatibility_nodebug(self):
        args, extra = parse_args([
            'eggs',
            '--nodebug',
            '--client',
            '--host',
            'localhost',
            '--port',
            '8888',
            '--module',
            '--file',
            'spam',
        ])

        self.assertEqual(
            vars(args), {
                'kind': 'script',
                'name': 'spam',
                'address': Address.as_client('localhost', 8888),
                'nodebug': True,
                'single_session': False,
                'wait': False,
                'multiprocess': False,
            })
        self.assertEqual(extra, ['--module'] + self.EXPECTED_EXTRA)
Esempio n. 7
0
    def test_script(self):
        args, extra = parse_args([
            'eggs',
            '--port',
            '8888',
            'spam.py',
        ])

        self.assertEqual(
            vars(args), {
                'kind': 'script',
                'name': 'spam.py',
                'address': Address.as_server(None, 8888),
                'nodebug': False,
                'single_session': False,
            })
        self.assertEqual(extra, self.EXPECTED_EXTRA)
Esempio n. 8
0
    def test_module(self):
        args, extra = parse_args([
            'eggs',
            '--port', '8888',
            '-m', 'spam',
        ])

        self.assertEqual(vars(args), {
            'kind': 'module',
            'name': 'spam',
            'address': Address.as_server(None, 8888),
            'nodebug': False,
            'single_session': False,
            'wait': False,
            'multiprocess': False,
        })
        self.assertEqual(extra, self.EXPECTED_EXTRA)
Esempio n. 9
0
    def test_backward_compatibility_host(self):
        args, extra = parse_args([
            'eggs',
            '--client', '1.2.3.4',
            '--port', '8888',
            '-m', 'spam',
        ])

        self.assertEqual(vars(args), {
            'kind': 'module',
            'name': 'spam',
            'address': Address.as_client('1.2.3.4', 8888),
            'nodebug': False,
            'single_session': False,
            'wait': False,
            'multiprocess': False,
        })
        self.assertEqual(extra, self.EXPECTED_EXTRA)
Esempio n. 10
0
    def test_script_server(self):
        args, extra = parse_args([
            'eggs',
            '--server-host', '10.0.1.1',
            '--port', '8888',
            'spam.py',
        ])

        self.assertEqual(vars(args), {
            'kind': 'script',
            'name': 'spam.py',
            'address': Address.as_server('10.0.1.1', 8888),
            'nodebug': False,
            'single_session': False,
            'wait': False,
            'multiprocess': False,
        })
        self.assertEqual(extra, self.EXPECTED_EXTRA)
Esempio n. 11
0
    def test_backward_compatibility_script_nodebug(self):
        args, extra = parse_args([
            'eggs',
            '--nodebug',
            '--port', '8888',
            '--file', 'spam.py',
        ])

        self.assertEqual(vars(args), {
            'kind': 'script',
            'name': 'spam.py',
            'address': Address.as_client(None, 8888),
            'nodebug': True,
            'single_session': False,
            'wait': False,
            'multiprocess': False,
        })
        self.assertEqual(extra, self.EXPECTED_EXTRA)
Esempio n. 12
0
    def test_remote_localhost(self):
        args, extra = parse_args([
            'eggs',
            '--host', 'localhost',
            '--port', '8888',
            'spam.py',
        ])

        self.assertEqual(vars(args), {
            'kind': 'script',
            'name': 'spam.py',
            'address': Address.as_client('localhost', 8888),
            'nodebug': False,
            'single_session': False,
            'wait': False,
            'multiprocess': False,
        })
        self.assertEqual(extra, self.EXPECTED_EXTRA)
Esempio n. 13
0
def test_script_server():
    args, extra = parse_args([
        'eggs',
        '--host', '10.0.1.1',
        '--port', '8888',
        'spam.py',
    ])

    assert vars(args) == {
        'kind': 'script',
        'name': 'spam.py',
        'address': Address.as_server('10.0.1.1', 8888),
        'nodebug': False,
        'single_session': False,
        'wait': False,
        'multiprocess': False,
    }
    assert extra == EXPECTED_EXTRA
Esempio n. 14
0
    def test_pseudo_backward_compatibility(self):
        args, extra = parse_args([
            'eggs',
            '--port',
            '8888',
            '--module',
            '--file',
            'spam',
        ])

        self.assertEqual(
            vars(args), {
                'kind': 'script',
                'name': 'spam',
                'address': Address.as_server(None, 8888),
                'nodebug': False,
                'single_session': False,
            })
        self.assertEqual(extra, ['--module'] + self.EXPECTED_EXTRA)
Esempio n. 15
0
def test_remote_localhost():
    args, extra = parse_args([
        'eggs',
        '--client',
        '--host', 'localhost',
        '--port', '8888',
        'spam.py',
    ])

    assert vars(args) == {
        'kind': 'script',
        'name': 'spam.py',
        'address': Address.as_client('localhost', 8888),
        'nodebug': False,
        'single_session': False,
        'wait': False,
        'multiprocess': False,
    }
    assert extra == EXPECTED_EXTRA
Esempio n. 16
0
def test_pseudo_backward_compatibility():
    args, extra = parse_args([
        'eggs',
        '--host', 'localhost',
        '--port', '8888',
        '--module',
        '--file', 'spam',
    ])

    assert vars(args) == {
        'kind': 'script',
        'name': 'spam',
        'address': Address.as_server('localhost', 8888),
        'nodebug': False,
        'single_session': False,
        'wait': False,
        'multiprocess': False,
    }
    assert extra == ['--module'] + EXPECTED_EXTRA
Esempio n. 17
0
    def test_local_single_session(self):
        args, extra = parse_args([
            'eggs',
            '--single-session',
            '--server-host',
            '1.2.3.4',
            '--port',
            '8888',
            'spam.py',
        ])

        self.assertEqual(
            vars(args), {
                'kind': 'script',
                'name': 'spam.py',
                'address': Address.as_server('1.2.3.4', 8888),
                'nodebug': False,
                'single_session': True,
            })
        self.assertEqual(extra, self.EXPECTED_EXTRA)
Esempio n. 18
0
def test_extra_nodebug():
    args, extra = parse_args([
        'eggs',
        '--DEBUG',
        '--nodebug',
        '--client',
        '--host', 'localhost',
        '--port', '8888',
        '--vm_type', '???',
        'spam.py',
        '--xyz', '123',
        'abc',
        '--cmd-line',
        '--',
        'foo',
        '--server',
        '--bar'
    ])

    assert vars(args) == {
        'kind': 'script',
        'name': 'spam.py',
        'address': Address.as_client('localhost', 8888),
        'nodebug': True,
        'single_session': False,
        'wait': False,
        'multiprocess': False,
    }
    assert extra == [
        '--DEBUG',
        '--vm_type', '???',
        '--',  # Expected pydevd defaults separator
        '--xyz', '123',
        'abc',
        '--cmd-line',
        'foo',
        '--server',
        '--bar',
    ]