Esempio n. 1
0
def test_subcommand_list(tmpdir):
    a = tmpdir.mkdir("a")
    for cmd in ('jupyter-foo-bar',
                'jupyter-xyz',
                'jupyter-babel-fish'):
        a.join(cmd).write('')
    b = tmpdir.mkdir("b")
    for cmd in ('jupyter-foo',
                'jupyterstuff',
                'jupyter-yo-eyropa-ganymyde-callysto'):
        b.join(cmd).write('')
    c = tmpdir.mkdir("c")
    for cmd in ('jupyter-baz',
                'jupyter-bop'):
        c.join(cmd).write('')
    
    path = os.pathsep.join(map(str, [a, b]))

    def get_path(dummy):
        return str(c)
    
    with patch.object(sysconfig, 'get_path', get_path):
        with patch.dict('os.environ', {'PATH': path}):
            subcommands = list_subcommands()
            assert subcommands == [
                'babel-fish',
                'baz',
                'bop',
                'foo',
                'xyz',
                'yo-eyropa-ganymyde-callysto',
            ]
Esempio n. 2
0
def test_subcommand_list(tmpdir):
    a = tmpdir.mkdir("a")
    for cmd in ("jupyter-foo-bar", "jupyter-xyz", "jupyter-babel-fish"):
        a.join(cmd).write("")
    b = tmpdir.mkdir("b")
    for cmd in ("jupyter-foo", "jupyterstuff", "jupyter-yo-eyropa-ganymyde-callysto"):
        b.join(cmd).write("")

    path = os.pathsep.join(map(str, [a, b]))

    with patch.dict("os.environ", {"PATH": path}):
        subcommands = list_subcommands()
        assert subcommands == ["babel-fish", "foo", "xyz", "yo-eyropa-ganymyde-callysto"]
Esempio n. 3
0
def test_subcommand_list(tmpdir):
    a = tmpdir.mkdir("a")
    for cmd in ('jupyter-foo-bar', 'jupyter-xyz', 'jupyter-babel-fish'):
        a.join(cmd).write('')
    b = tmpdir.mkdir("b")
    for cmd in ('jupyter-foo', 'jupyterstuff',
                'jupyter-yo-eyropa-ganymyde-callysto'):
        b.join(cmd).write('')

    path = os.pathsep.join(map(str, [a, b]))

    with patch.dict('os.environ', {'PATH': path}):
        subcommands = list_subcommands()
        assert subcommands == [
            'babel-fish',
            'foo',
            'xyz',
            'yo-eyropa-ganymyde-callysto',
        ]
Esempio n. 4
0
def test_subcommand_list(tmpdir):
    a = tmpdir.mkdir("a")
    for cmd in ('jupyter-foo-bar',
                'jupyter-xyz',
                'jupyter-babel-fish'):
        a.join(cmd).write('')
    b = tmpdir.mkdir("b")
    for cmd in ('jupyter-foo',
                'jupyterstuff',
                'jupyter-yo-eyropa-ganymyde-callysto'):
        b.join(cmd).write('')
    
    path = os.pathsep.join(map(str, [a, b]))
    
    with patch.dict('os.environ', {'PATH': path}):
        subcommands = list_subcommands()
        assert subcommands == [
            'babel-fish',
            'foo',
            'xyz',
            'yo-eyropa-ganymyde-callysto',
        ]