Example #1
0
def get_data_dir():
    # Some tests need input files to operate on. There are two cases:
    if getattr(sys, 'frozen', False):
        # 1. Frozen: rely on gettemp to find the correct directory both in
        #    onefile and in onedir modes.
        return gettemp('data')
    else:
        # 2. Not frozen: rely on the filesystem layout of this git repository.
        return os.path.join(os.path.dirname(os.path.abspath(__file__)), '..',
                            'data')
Example #2
0
def get_data_dir():
    # Some tests need input files to operate on. There are two cases:
    if getattr(sys, 'frozen', False):
        # 1. Frozen: rely on gettemp to find the correct directory both in
        #    onefile and in onedir modes.
        return gettemp('data')
    else:
        # 2. Not frozen: rely on the filesystem layout of this git repository.
        return os.path.join(os.path.dirname(os.path.abspath(__file__)),
                            '..', 'data')
# Copyright (c) 2005-2016, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------

import sys
import codecs


# Get the expected stdout/stderr encoding for this platform.
from pyi_testmod_gettemp import gettemp

with open(gettemp("stderr_encoding.build")) as f:
    encoding = f.read()
frozen_encoding = str(sys.stderr.encoding)

# Skip normalizing if encoding is None. This happens for Python 2.
if not encoding == 'None' and not frozen_encoding == 'None':
    # Normalize encoding names - "UTF-8" should be the same as "utf8"
    encoding = codecs.lookup(encoding).name
    frozen_encoding = codecs.lookup(frozen_encoding).name


print('Encoding expected: ' + encoding)
print('Encoding current: ' + frozen_encoding)

if not frozen_encoding == encoding:
    raise SystemExit('Frozen encoding %s is not the same as unfrozen %s.' %
Example #4
0
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#
# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
#-----------------------------------------------------------------------------

import sys
import codecs

# Get the expected stdout/stderr encoding for this platform.
from pyi_testmod_gettemp import gettemp

with open(gettemp("stdout_encoding.build")) as f:
    encoding = f.read()
frozen_encoding = sys.stdout.encoding

# Normalize encoding names - "UTF-8" should be the same as "utf8"
encoding = codecs.lookup(encoding).name
frozen_encoding = codecs.lookup(frozen_encoding).name

print('Encoding expected:', encoding)
print('Encoding current:', frozen_encoding)

if frozen_encoding != encoding:
    raise SystemExit('Frozen encoding %s is not the same as unfrozen %s.' %
                     (frozen_encoding, encoding))

Example #5
0
#-----------------------------------------------------------------------------


# Compare attributes of ElementTree (cElementTree) module from frozen executable
# with ElementTree (cElementTree) module from standard python.


import copy
import os
import subprocess
import xml.etree.ElementTree as ET
import xml.etree.cElementTree as cET

from pyi_testmod_gettemp import gettemp

_pyexe_file = gettemp("python_exe.build")

with open(_pyexe_file) as fp:
    _lines = fp.readlines()
    _pyexe = _lines[0].strip()
    _env_path = _lines[2].strip()


def exec_python(pycode):
    """
    Wrap running python script in a subprocess.

    Return stdout of the invoked command.
    """
    # Environment variable 'PATH' has to be defined on Windows.
    # Otherwise dynamic library pythonXY.dll cannot be found by
#-----------------------------------------------------------------------------


# Compare attributes of ElementTree (cElementTree) module from frozen executable
# with ElementTree (cElementTree) module from standard python.


import copy
import os
import subprocess
import xml.etree.ElementTree as ET
import xml.etree.cElementTree as cET

from pyi_testmod_gettemp import gettemp

_pyexe_file = gettemp("python_exe.build")

with open(_pyexe_file) as fp:
    _lines = fp.readlines()
    _pyexe = _lines[0].strip()
    _env_path = _lines[2].strip()


def exec_python(pycode):
    """
    Wrap running python script in a subprocess.

    Return stdout of the invoked command.
    """
    # Environment variable 'PATH' has to be defined on Windows.
    # Otherwise dynamic library pythonXY.dll cannot be found by
Example #7
0
# Copyright (c) 2005-2015, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------

import sys
import codecs


# Get the expected stdout/stderr encoding for this platform.
from pyi_testmod_gettemp import gettemp

with open(gettemp("stdout_encoding.build")) as f:
    encoding = f.read()
frozen_encoding = str(sys.stdout.encoding)

# Skip normalizing if encoding is None. This happens for Python 2.
if not encoding == 'None' and not frozen_encoding == 'None':
    # Normalize encoding names - "UTF-8" should be the same as "utf8"
    encoding = codecs.lookup(encoding).name
    frozen_encoding = codecs.lookup(frozen_encoding).name


print('Encoding expected: ' + encoding)
print('Encoding current: ' + frozen_encoding)

if not frozen_encoding == encoding:
    raise SystemExit('Frozen encoding %s is not the same as unfrozen %s.' %