[tests] move imports into functions
This commit is contained in:
parent
963103b859
commit
3ceeba23b8
2 changed files with 6 additions and 4 deletions
|
|
@ -5,11 +5,13 @@ from numpy.testing import assert_allclose
|
||||||
|
|
||||||
from ..pattern import Pattern
|
from ..pattern import Pattern
|
||||||
from ..library import Library
|
from ..library import Library
|
||||||
from ..file import gdsii, oasis
|
|
||||||
from ..shapes import Path as MPath, Circle, Polygon
|
from ..shapes import Path as MPath, Circle, Polygon
|
||||||
from ..repetition import Grid, Arbitrary
|
from ..repetition import Grid, Arbitrary
|
||||||
|
|
||||||
def create_test_library(for_gds: bool = False) -> Library:
|
def create_test_library(for_gds: bool = False) -> Library:
|
||||||
|
from ..file import gdsii
|
||||||
|
if not for_gds:
|
||||||
|
from ..file import oasis
|
||||||
lib = Library()
|
lib = Library()
|
||||||
|
|
||||||
# 1. Polygons
|
# 1. Polygons
|
||||||
|
|
@ -62,6 +64,7 @@ def create_test_library(for_gds: bool = False) -> Library:
|
||||||
return lib
|
return lib
|
||||||
|
|
||||||
def test_gdsii_full_roundtrip(tmp_path: Path) -> None:
|
def test_gdsii_full_roundtrip(tmp_path: Path) -> None:
|
||||||
|
from ..file import gdsii
|
||||||
lib = create_test_library(for_gds=True)
|
lib = create_test_library(for_gds=True)
|
||||||
gds_file = tmp_path / "full_test.gds"
|
gds_file = tmp_path / "full_test.gds"
|
||||||
gdsii.writefile(lib, gds_file, meters_per_unit=1e-9)
|
gdsii.writefile(lib, gds_file, meters_per_unit=1e-9)
|
||||||
|
|
@ -110,6 +113,7 @@ def test_gdsii_full_roundtrip(tmp_path: Path) -> None:
|
||||||
|
|
||||||
def test_oasis_full_roundtrip(tmp_path: Path) -> None:
|
def test_oasis_full_roundtrip(tmp_path: Path) -> None:
|
||||||
pytest.importorskip("fatamorgana")
|
pytest.importorskip("fatamorgana")
|
||||||
|
from ..file import oasis
|
||||||
lib = create_test_library(for_gds=False)
|
lib = create_test_library(for_gds=False)
|
||||||
oas_file = tmp_path / "full_test.oas"
|
oas_file = tmp_path / "full_test.oas"
|
||||||
oasis.writefile(lib, oas_file, units_per_micron=1000)
|
oasis.writefile(lib, oas_file, units_per_micron=1000)
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,10 @@ from numpy.testing import assert_equal
|
||||||
|
|
||||||
from ..pattern import Pattern
|
from ..pattern import Pattern
|
||||||
from ..library import Library
|
from ..library import Library
|
||||||
from ..file import oasis
|
|
||||||
|
|
||||||
|
|
||||||
def test_oasis_roundtrip(tmp_path: Path) -> None:
|
def test_oasis_roundtrip(tmp_path: Path) -> None:
|
||||||
# Skip if fatamorgana is not installed
|
# Skip if fatamorgana is not installed
|
||||||
pytest.importorskip("fatamorgana")
|
pytest.importorskip("fatamorgana")
|
||||||
|
from ..file import oasis
|
||||||
|
|
||||||
lib = Library()
|
lib = Library()
|
||||||
pat1 = Pattern()
|
pat1 = Pattern()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue