Exemple #1
0
def test_xshxontrib(tmpmod):
    """
    Test that .xsh xontribs are loadable
    """
    with tmpmod.mkdir("xontrib").join("script.xsh").open('w') as x:
        x.write("""
hello = 'world'
""")

    ctx = xontrib_context('script')
    assert ctx == {'hello': 'world'}
Exemple #2
0
def test_xshxontrib(tmpmod):
    """
    Test that .xsh xontribs are loadable
    """
    with tmpmod.mkdir("xontrib").join("script.xsh").open('w') as x:
        x.write("""
hello = 'world'
""")

    ctx = xontrib_context('script')
    assert ctx == {'hello': 'world'}
Exemple #3
0
def test_noall(tmpmod):
    """
    Tests what get's exported from a module without __all__
    """

    with tmpmod.mkdir("xontrib").join("spameggs.py").open('w') as x:
        x.write("""
spam = 1
eggs = 2
_foobar = 3
""")

    ctx = xontrib_context('spameggs')
    assert ctx == {'spam': 1, 'eggs': 2}
Exemple #4
0
def test_noall(tmpmod):
    """
    Tests what get's exported from a module without __all__
    """

    with tmpmod.mkdir("xontrib").join("spameggs.py").open('w') as x:
        x.write("""
spam = 1
eggs = 2
_foobar = 3
""")

    ctx = xontrib_context('spameggs')
    assert ctx == {'spam': 1, 'eggs': 2}
Exemple #5
0
def test_withall(tmpmod):
    """
    Tests what get's exported from a module with __all__
    """

    with tmpmod.mkdir("xontrib").join("spameggs.py").open("w") as x:
        x.write("""
__all__ = 'spam', '_foobar'
spam = 1
eggs = 2
_foobar = 3
""")

    ctx = xontrib_context("spameggs")
    assert ctx == {"spam": 1, "_foobar": 3}