[ADD] installed testcase

This commit is contained in:
Benedek Racz 2020-02-22 20:56:56 +01:00
parent 6c282ed544
commit 0e6fcf1442
4 changed files with 46 additions and 13 deletions

View File

@ -13,11 +13,16 @@ environment:
# Set default pytohn, the real matrinx is in the tox settings.
matrix:
- TOXENV: py37-default
PYTHON: "C:\\Python37"
- TOXENV: py37-legacy_wexpect
COVERAGE_FILENAME: py37-default_coverage.xml
COVERAGE_FILENAME: py37-legacy_wexpect_coverage.xml
PYTHON: "C:\\Python37"
- TOXENV: py37-spawn_pipe
COVERAGE_FILENAME: py37-spawn_pipe_coverage.xml
PYTHON: "C:\\Python37"
- TOXENV: installed
PYTHON: "C:\\Python37"
PYTHON: "C:\\Python37"
- TOXENV: py37-legacy_wexpect
build: off
@ -31,18 +36,22 @@ test_script:
after_test:
# Upload code coverage results.
# https://github.com/codecov/codecov-python/issues/158#issuecomment-514282362
- (codecov --no-color -X gcov --file %TOXENV%_coverage.xml --required ) || (sleep 30 && codecov --no-color -X gcov --file %TOXENV%_coverage.xml --required )
- IF "%COVERAGE_FILENAME%"!="" (
(codecov --no-color -X gcov --file %COVERAGE_FILENAME% --required ) || (sleep 30 && codecov --no-color -X gcov --file %COVERAGE_FILENAME% --required )
)
# fill .pypirc file.
# pypi
- cmd: "echo [pypi] > %USERPROFILE%\\.pypirc"
- cmd: "echo repository: https://upload.pypi.org/legacy/ >> %USERPROFILE%\\.pypirc"
- cmd: "echo username: __token__ >> %USERPROFILE%\\.pypirc"
- cmd: "echo password: %pypipw% >> %USERPROFILE%\\.pypirc"
- |-
"echo [pypi] > %USERPROFILE%\\.pypirc"
"echo repository: https://upload.pypi.org/legacy/ >> %USERPROFILE%\\.pypirc"
"echo username: __token__ >> %USERPROFILE%\\.pypirc"
"echo password: %pypipw% >> %USERPROFILE%\\.pypirc"
# testpypi
- cmd: "echo [testpypi] >> %USERPROFILE%\\.pypirc"
- cmd: "echo repository: https://test.pypi.org/legacy/ >> %USERPROFILE%\\.pypirc"
- cmd: "echo username: __token__ >> %USERPROFILE%\\.pypirc"
- cmd: "echo password: %testpypipw% >> %USERPROFILE%\\.pypirc"
- |-
"echo [testpypi] >> %USERPROFILE%\\.pypirc"
"echo repository: https://test.pypi.org/legacy/ >> %USERPROFILE%\\.pypirc"
"echo username: __token__ >> %USERPROFILE%\\.pypirc"
"echo password: %testpypipw% >> %USERPROFILE%\\.pypirc"
# Create source distribution.
- python -m setup sdist

22
tox.ini
View File

@ -8,6 +8,9 @@ envlist = py{37}-{default,legacy_wexpect,spawn_pipe}
[testenv]
description = Unit tests
passenv =
WEXPECT_*
# Set environment variables to select the proper configuration for each envirnment.
setenv =
spawn_pipe: WEXPECT_SPAWN_CLASS=SpawnPipe
@ -26,3 +29,22 @@ commands =
# Convert coverage report to standard xml formula the filename includes the tox environment name
# https://tox.readthedocs.io/en/latest/config.html#environment-variable-substitutions
coverage xml --omit=tests/*,site-packages -o {env:TOX_ENV_NAME}_coverage.xml
[testenv:installed]
# normal tests test the cloned files. This testenv tests the installation itself.
description = Unit tests installed
changedir = test_installed_01
# Appveyor will set the WEXPECT_SPAWN_CLASS to run the proper configuration for each run.
passenv =
WEXPECT_*
commands =
# copy all testcase into working dir
cp -r ../tests tests
# Run the test itself
python -m unittest

View File

@ -107,7 +107,7 @@ class ConsoleReaderBase:
self.child_pid = None
self.enable_signal_chars = True
logger.info("ConsoleReader started")
logger.info(f'ConsoleReader started. location {os.path.abspath(__file__)}')
if codepage is None:
codepage = windll.kernel32.GetACP()

View File

@ -261,6 +261,8 @@ class SpawnBase:
self.searchwindowsize = searchwindowsize
self.interact_state = interact
logger.info(f'Spawn started. location {os.path.abspath(__file__)}')
# If command is an int type then it may represent a file descriptor.
if isinstance(command, int):
logger.warning(
@ -372,7 +374,7 @@ class SpawnBase:
}
)
console_class_parameters_kv_pairs = [
f'--{k}={v}'for k, v in self.console_class_parameters.items() if v is not None
f'--{k}={v}'for k, v in self.console_class_parameters.items() if v is not None
]
console_class_parameters_str = ' '.join(console_class_parameters_kv_pairs)
args_str = join_args(args)