SLIDER-401 agent tests on windows
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/ce3f7009 Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/ce3f7009 Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/ce3f7009 Branch: refs/heads/develop Commit: ce3f7009e6e9fec204b264a9577a52632b9f3487 Parents: a9f0b98 Author: Steve Loughran <ste...@apache.org> Authored: Fri Sep 5 13:47:50 2014 +0100 Committer: Steve Loughran <ste...@apache.org> Committed: Fri Sep 5 13:47:50 2014 +0100 ---------------------------------------------------------------------- slider-agent/src/main/python/setup.py | 2 +- slider-agent/src/test/python/unitTests.py | 31 ++++++++++++-------------- 2 files changed, 15 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ce3f7009/slider-agent/src/main/python/setup.py ---------------------------------------------------------------------- diff --git a/slider-agent/src/main/python/setup.py b/slider-agent/src/main/python/setup.py index 421b5f9..56969b6 100644 --- a/slider-agent/src/main/python/setup.py +++ b/slider-agent/src/main/python/setup.py @@ -17,7 +17,7 @@ from setuptools import setup setup( name = "slider-agent", - version = "0.31.0-incubating-SNAPSHOT", + version = "0.51.0-incubating-SNAPSHOT", packages = ['agent'], # metadata for upload to PyPI author = "Apache Software Foundation", http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ce3f7009/slider-agent/src/test/python/unitTests.py ---------------------------------------------------------------------- diff --git a/slider-agent/src/test/python/unitTests.py b/slider-agent/src/test/python/unitTests.py index b01438e..bab121f 100644 --- a/slider-agent/src/test/python/unitTests.py +++ b/slider-agent/src/test/python/unitTests.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -''' +""" Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information @@ -16,14 +16,13 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -''' +""" import unittest -import doctest -from os.path import dirname, split, isdir -import logging.handlers +from os.path import isdir import logging -from random import shuffle +import os +import sys LOG_FILE_NAME='tests.log' SELECTED_PREFIX = "_" @@ -31,9 +30,9 @@ PY_EXT='.py' ignoredDirs = ["mock"] class TestAgent(unittest.TestSuite): - def run(self, result): + def run(self, result, debug=False): run = unittest.TestSuite.run - run(self, result) + run(self, result, debug) return result @@ -41,19 +40,19 @@ def parent_dir(path): if isdir(path): if path.endswith(os.sep): path = os.path.dirname(path) - parent_dir = os.path.dirname(path) + parent = os.path.dirname(path) else: - parent_dir = os.path.dirname(os.path.dirname(path)) + parent = os.path.dirname(os.path.dirname(path)) - return parent_dir + return parent def all_tests_suite(): - src_dir = os.getcwd() + root_dir = os.getcwd() files_list = [] - for directory in os.listdir(src_dir): + for directory in os.listdir(root_dir): if os.path.isdir(directory) and not directory in ignoredDirs: - files_list += os.listdir(src_dir + os.sep + directory) + files_list += os.listdir(root_dir + os.sep + directory) ## temporarily deleting to add more predictability ## shuffle(files_list) files_list.sort() @@ -99,9 +98,7 @@ def main(): logger.info('------------------------------------------------------------------------') if __name__ == '__main__': - import os - import sys - import io + sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + os.sep + 'main' + os.sep + 'python') sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + os.sep + 'main' + os.sep + 'python' + os.sep + 'agent')