Skip to content

Commit

Permalink
tests: add a test for legacy onedir mode
Browse files Browse the repository at this point in the history
Add a basic test with --contents-directory=. that checks if
`sys._MEIPASS` == `os.path.dirname(sys.executable)`, which should
be the case in the legacy onedir layout.
  • Loading branch information
rokm committed Sep 30, 2023
1 parent 8071815 commit bc51355
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/functional/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,24 @@ def test_contents_directory(pyi_builder):
pyi_builder.test_source("", pyi_args=["--contents-directory=..", "--noconfirm"])


def test_legacy_onedir_layout(pyi_builder):
"""
Test the --contents-directory=., which re-enables the legacy onedir layout.
"""
if pyi_builder._mode != 'onedir':
pytest.skip('--contents-directory does not affect onefile builds.')

pyi_builder.test_source(
"""
import sys
import os
assert sys._MEIPASS == os.path.dirname(sys.executable)
assert os.path.dirname(__file__) == os.path.dirname(sys.executable)
""",
pyi_args=["--contents-directory", "."]
)


def test_spec_options(pyi_builder, SPEC_DIR, capsys):
if pyi_builder._mode != 'onedir':
pytest.skip('spec file is onedir mode only')
Expand Down

0 comments on commit bc51355

Please sign in to comment.