From 0e6fcf1442a2e1ffc22ec2951ac8dd9538dfb9d8 Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Sat, 22 Feb 2020 20:56:56 +0100 Subject: [PATCH] [ADD] installed testcase --- appveyor.yml | 31 ++++++++++++++++++++----------- tox.ini | 22 ++++++++++++++++++++++ wexpect/console_reader.py | 2 +- wexpect/host.py | 4 +++- 4 files changed, 46 insertions(+), 13 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 4a573dc..a699920 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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 diff --git a/tox.ini b/tox.ini index 97eaf01..31908bd 100644 --- a/tox.ini +++ b/tox.ini @@ -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 + \ No newline at end of file diff --git a/wexpect/console_reader.py b/wexpect/console_reader.py index f2dc4e7..1e83686 100644 --- a/wexpect/console_reader.py +++ b/wexpect/console_reader.py @@ -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() diff --git a/wexpect/host.py b/wexpect/host.py index 83f8259..e21c899 100644 --- a/wexpect/host.py +++ b/wexpect/host.py @@ -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)