From a722ed532ff254d1ce657466b7b1aac264433f7e Mon Sep 17 00:00:00 2001 From: Damien George Date: Sun, 8 Jan 2017 22:45:55 +1100 Subject: [PATCH] tests/unix/extra_coverage: Add tests for importing frozen packages. --- tests/unix/extra_coverage.py | 12 ++++++++++++ tests/unix/extra_coverage.py.exp | 8 ++++++++ unix/coverage-frzmpy/frzmpy_pkg1/__init__.py | 3 +++ unix/coverage-frzmpy/frzmpy_pkg2/mod.py | 4 ++++ unix/coverage-frzstr/frzstr_pkg1/__init__.py | 3 +++ unix/coverage-frzstr/frzstr_pkg2/mod.py | 4 ++++ 6 files changed, 34 insertions(+) create mode 100644 unix/coverage-frzmpy/frzmpy_pkg1/__init__.py create mode 100644 unix/coverage-frzmpy/frzmpy_pkg2/mod.py create mode 100644 unix/coverage-frzstr/frzstr_pkg1/__init__.py create mode 100644 unix/coverage-frzstr/frzstr_pkg2/mod.py diff --git a/tests/unix/extra_coverage.py b/tests/unix/extra_coverage.py index 7bff6d8548..f2b40282b3 100644 --- a/tests/unix/extra_coverage.py +++ b/tests/unix/extra_coverage.py @@ -17,3 +17,15 @@ print(hash(str(data[1], 'utf8'))) # test basic import of frozen scripts import frzstr1 import frzmpy1 + +# test import of frozen packages with __init__.py +import frzstr_pkg1 +print(frzstr_pkg1.x) +import frzmpy_pkg1 +print(frzmpy_pkg1.x) + +# test import of frozen packages without __init__.py +from frzstr_pkg2.mod import Foo +print(Foo.x) +from frzmpy_pkg2.mod import Foo +print(Foo.x) diff --git a/tests/unix/extra_coverage.py.exp b/tests/unix/extra_coverage.py.exp index 50bed4dcff..d3d7252115 100644 --- a/tests/unix/extra_coverage.py.exp +++ b/tests/unix/extra_coverage.py.exp @@ -50,3 +50,11 @@ Warning: test 7300 frzstr1 frzmpy1 +frzstr_pkg1.__init__ +1 +frzmpy_pkg1.__init__ +1 +frzstr_pkg2.mod +1 +frzmpy_pkg2.mod +1 diff --git a/unix/coverage-frzmpy/frzmpy_pkg1/__init__.py b/unix/coverage-frzmpy/frzmpy_pkg1/__init__.py new file mode 100644 index 0000000000..8c023afeba --- /dev/null +++ b/unix/coverage-frzmpy/frzmpy_pkg1/__init__.py @@ -0,0 +1,3 @@ +# test frozen package with __init__.py +print('frzmpy_pkg1.__init__') +x = 1 diff --git a/unix/coverage-frzmpy/frzmpy_pkg2/mod.py b/unix/coverage-frzmpy/frzmpy_pkg2/mod.py new file mode 100644 index 0000000000..a66b505bf6 --- /dev/null +++ b/unix/coverage-frzmpy/frzmpy_pkg2/mod.py @@ -0,0 +1,4 @@ +# test frozen package without __init__.py +print('frzmpy_pkg2.mod') +class Foo: + x = 1 diff --git a/unix/coverage-frzstr/frzstr_pkg1/__init__.py b/unix/coverage-frzstr/frzstr_pkg1/__init__.py new file mode 100644 index 0000000000..1d1df9417e --- /dev/null +++ b/unix/coverage-frzstr/frzstr_pkg1/__init__.py @@ -0,0 +1,3 @@ +# test frozen package with __init__.py +print('frzstr_pkg1.__init__') +x = 1 diff --git a/unix/coverage-frzstr/frzstr_pkg2/mod.py b/unix/coverage-frzstr/frzstr_pkg2/mod.py new file mode 100644 index 0000000000..bafb5978b0 --- /dev/null +++ b/unix/coverage-frzstr/frzstr_pkg2/mod.py @@ -0,0 +1,4 @@ +# test frozen package without __init__.py +print('frzstr_pkg2.mod') +class Foo: + x = 1