Exemplo n.º 1
0
def test_import_function(mock_hello_file):
    hello = import_remote_file("hello", mock_hello_file)
    assert hello.say_hello() == "hello"
Exemplo n.º 2
0
def test_import_name(mock_hello_file):
    hello = import_remote_file("hello", mock_hello_file)
    assert hello.__name__ == "hello"
Exemplo n.º 3
0
def test_import(mock_hello_file):
    import_remote_file("hello", mock_hello_file)
Exemplo n.º 4
0
def test_invalid_file_import(bad_file):
    with pytest.raises(SyntaxError):
        import_remote_file("foo", bad_file)
Exemplo n.º 5
0
def test_invalid_module_name(python_file):
    with pytest.raises(ValueError):
        import_remote_file("foo bar", python_file)
Exemplo n.º 6
0
def test_normal_file_import(python_file):
    foo = import_remote_file("foo", python_file)
    assert foo.__name__ == "foo"
    assert foo.say_bar() == "bar"