-
Notifications
You must be signed in to change notification settings - Fork 775
Expand file tree
/
Copy pathtest_import.py
More file actions
27 lines (20 loc) · 814 Bytes
/
test_import.py
File metadata and controls
27 lines (20 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# -*- coding: utf-8 -*-
"""Test the import statement."""
import pytest
import sys
# Unused import to preload the class
#
# This resulted in the FileStream name missing from the wildcard import later
from System.IO import FileStream # noqa: F401
def test_relative_missing_import():
"""Test that a relative missing import doesn't crash.
Some modules use this to check if a package is installed.
Relative import in the site-packages folder"""
with pytest.raises(ImportError):
from . import _missing_import
def test_import_all_on_second_time():
"""Test import all attributes after a normal import without '*'.
Due to import * only allowed at module level, the test body splitted
to a module file."""
from . import importtest
del sys.modules[importtest.__name__]