Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-28-integrate-appveyor daaff6432 -> fe974e49f (forced update)
ARIA-28 Integrate with appveyor Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/fe974e49 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/fe974e49 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/fe974e49 Branch: refs/heads/ARIA-28-integrate-appveyor Commit: fe974e49f7e209dce9eb252c67406b02509bd0b5 Parents: d7addbc Author: Dan Kilman <[email protected]> Authored: Wed Nov 30 14:13:06 2016 +0200 Committer: Dan Kilman <[email protected]> Committed: Wed Nov 30 15:29:27 2016 +0200 ---------------------------------------------------------------------- appveyor.yml | 26 +++++++++++++++++ tests/storage/__init__.py | 2 +- tests/test_logger.py | 63 +++++++++++++++++++++--------------------- tox.ini | 7 +++-- 4 files changed, 63 insertions(+), 35 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fe974e49/appveyor.yml ---------------------------------------------------------------------- diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..3ea8635 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,26 @@ +environment: + + TOX_ENV: pywin + + matrix: + - PYTHON: C:\Python27 + PYTHON_VERSION: 2.7.8 + PYTHON_ARCH: 32 + +build: false + +install: + - SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH% + - ps: (new-object System.Net.WebClient).Downloadfile('https://bootstrap.pypa.io/get-pip.py', 'C:\Users\appveyor\get-pip.py') + - ps: Start-Process -FilePath "C:\Python27\python.exe" -ArgumentList "C:\Users\appveyor\get-pip.py" -Wait -Passthru + +before_test: + - pip install virtualenv --upgrade + - virtualenv env + - 'env\Scripts\activate.bat' + - pip install tox + +test_script: + - pip --version + - tox --version + - tox -e %TOX_ENV% http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fe974e49/tests/storage/__init__.py ---------------------------------------------------------------------- diff --git a/tests/storage/__init__.py b/tests/storage/__init__.py index 3408f2b..9bf48cc 100644 --- a/tests/storage/__init__.py +++ b/tests/storage/__init__.py @@ -50,4 +50,4 @@ class TestFileSystem(object): self.path = mkdtemp('{0}'.format(self.__class__.__name__)) def teardown_method(self): - rmtree(self.path) + rmtree(self.path, ignore_errors=True) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fe974e49/tests/test_logger.py ---------------------------------------------------------------------- diff --git a/tests/test_logger.py b/tests/test_logger.py index 8c7a9af..0199068 100644 --- a/tests/test_logger.py +++ b/tests/test_logger.py @@ -14,7 +14,6 @@ # limitations under the License. import logging -import tempfile from aria.logger import (create_logger, create_console_log_handler, @@ -70,40 +69,40 @@ def test_create_console_log_handler(capsys): assert err.count(info_test_string) == 1 -def test_create_file_log_handler(): +def test_create_file_log_handler(tmpdir): test_string = 'create_file_log_test_string' - with tempfile.NamedTemporaryFile() as temp_file: - handler = create_file_log_handler(file_path=temp_file.name) - assert handler.baseFilename == temp_file.name - assert handler.maxBytes == 5 * 1000 * 1024 - assert handler.backupCount == 10 - assert handler.stream is None - assert handler.level == logging.DEBUG - assert handler.formatter == _default_file_formatter - - logger = create_logger(handlers=[handler]) - logger.debug(test_string) - assert test_string in temp_file.read() - - with tempfile.NamedTemporaryFile() as temp_file: - handler = create_file_log_handler( - file_path=temp_file.name, - level=logging.INFO, - max_bytes=1000, - backup_count=2, - formatter=logging.Formatter() - ) - assert handler.baseFilename == temp_file.name - assert handler.level == logging.INFO - assert handler.maxBytes == 1000 - assert handler.backupCount == 2 - assert isinstance(handler.formatter, logging.Formatter) - - logger = create_logger(handlers=[handler]) - logger.info(test_string) - assert test_string in temp_file.read() + debug_log = tmpdir.join('debug.log') + handler = create_file_log_handler(file_path=str(debug_log)) + assert handler.baseFilename == str(debug_log) + assert handler.maxBytes == 5 * 1000 * 1024 + assert handler.backupCount == 10 + assert handler.stream is None + assert handler.level == logging.DEBUG + assert handler.formatter == _default_file_formatter + + logger = create_logger(handlers=[handler]) + logger.debug(test_string) + assert test_string in debug_log.read() + + info_log = tmpdir.join('info.log') + handler = create_file_log_handler( + file_path=str(info_log), + level=logging.INFO, + max_bytes=1000, + backup_count=2, + formatter=logging.Formatter() + ) + assert handler.baseFilename == str(info_log) + assert handler.level == logging.INFO + assert handler.maxBytes == 1000 + assert handler.backupCount == 2 + assert isinstance(handler.formatter, logging.Formatter) + + logger = create_logger(handlers=[handler]) + logger.info(test_string) + assert test_string in info_log.read() def test_loggermixin(capsys): http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fe974e49/tox.ini ---------------------------------------------------------------------- diff --git a/tox.ini b/tox.ini index 8355b19..68f9ffa 100644 --- a/tox.ini +++ b/tox.ini @@ -11,7 +11,7 @@ # limitations under the License. [tox] -envlist=py27,py26,pylint_code,pylint_tests +envlist=py27,py26,pywin,pylint_code,pylint_tests [testenv] deps = @@ -20,6 +20,7 @@ deps = basepython = py26: python2.6 py27: python2.7 + pywin: {env:PYTHON:}\python.exe pylint_code: python2.7 pylint_tests: python2.7 @@ -29,9 +30,11 @@ commands=pytest tests --cov-report term-missing --cov aria [testenv:py26] commands=pytest tests --cov-report term-missing --cov aria +[testenv:pywin] +commands=pytest tests --cov-report term-missing --cov aria + [testenv:pylint_code] commands=pylint --rcfile=aria/.pylintrc --disable=fixme,missing-docstring --ignore=commands.py aria [testenv:pylint_tests] commands=pylint --rcfile=tests/.pylintrc --disable=fixme,missing-docstring tests -
