diff --git a/.coveragerc b/.coveragerc index 625ed87dbecd..385f1e4839f0 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,3 +1,10 @@ +[run] +include = + azure* +omit = + */test* + env* + [report] exclude_lines = pragma: no cover diff --git a/.travis.yml b/.travis.yml index 58b708ccea8b..3fc966269dfb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,19 +25,9 @@ install: - pip install -r requirements.txt - pip install azure-storage - pip install coveralls + - pip install nose - pip uninstall -y azure-common script: - - cd azure-servicebus/tests - - bash run-servicebus - - cd ../.. - - cd azure-servicemanagement-legacy/tests - - bash run-legacy-mgmt - - cd ../.. - - cd azure-mgmt/tests - - bash run-mgmt - - cd ../.. - - rm -f .coverage - - coverage combine azure-mgmt/tests/.coverage azure-servicebus/tests/.coverage azure-servicemanagement-legacy/tests/.coverage - - coverage report + - python ./azure_nosetests.py after_success: coveralls diff --git a/appveyor.yml b/appveyor.yml index 6d1f397820a7..053a82d5e8ef 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,16 +11,10 @@ install: - "%PYTHON%\\python.exe -m pip install -U pip" - "%PYTHON%\\python.exe -m pip install -r requirements.txt" - "%PYTHON%\\python.exe -m pip install azure-storage" + - "%PYTHON%\\python.exe -m pip install nose" + - "%PYTHON%\\python.exe -m pip install coveralls" - "%PYTHON%\\python.exe -m pip uninstall -y azure-common" build: off -test_script: - - cd azure-servicebus/tests - - run-servicebus.bat %PYTHON% - - cd ../.. - - cd azure-servicemanagement-legacy/tests - - run-legacy-mgmt.bat %PYTHON% - - cd ../.. - - cd azure-mgmt/tests - - run-mgmt.bat %PYTHON% +test_script: "%PYTHON%\\python.exe ./azure_nosetests.py" diff --git a/azure-mgmt/tests/.coveragerc b/azure-mgmt/tests/.coveragerc deleted file mode 100644 index 87ca64e0f27f..000000000000 --- a/azure-mgmt/tests/.coveragerc +++ /dev/null @@ -1,20 +0,0 @@ -[run] -source = - ../../azure-common/azure - ../../azure-mgmt/azure - ../../azure-mgmt-authorization/azure - ../../azure-mgmt-batch/azure - ../../azure-mgmt-cdn/azure - ../../azure-mgmt-compute/azure - ../../azure-mgmt-commerce/azure - ../../azure-mgmt-logic/azure - ../../azure-mgmt-network/azure - ../../azure-mgmt-notificationhubs/azure - ../../azure-mgmt-redis/azure - ../../azure-mgmt-resource/azure - ../../azure-mgmt-scheduler/azure - ../../azure-mgmt-storage/azure - ../../azure-mgmt-web/azure - ../../azure-batch/azure - ../../azure-graphrbac/azure -omit = */test* diff --git a/azure-mgmt/tests/run-mgmt b/azure-mgmt/tests/run-mgmt deleted file mode 100644 index 6060f9d0aa13..000000000000 --- a/azure-mgmt/tests/run-mgmt +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -export PYTHONPATH=$PYTHONPATH:../../azure-batch -export PYTHONPATH=$PYTHONPATH:../../azure-common -export PYTHONPATH=$PYTHONPATH:../../azure-mgmt -export PYTHONPATH=$PYTHONPATH:../../azure-mgmt-authorization -export PYTHONPATH=$PYTHONPATH:../../azure-mgmt-batch -export PYTHONPATH=$PYTHONPATH:../../azure-mgmt-cdn -export PYTHONPATH=$PYTHONPATH:../../azure-mgmt-commerce -export PYTHONPATH=$PYTHONPATH:../../azure-mgmt-compute -export PYTHONPATH=$PYTHONPATH:../../azure-mgmt-logic -export PYTHONPATH=$PYTHONPATH:../../azure-mgmt-network -export PYTHONPATH=$PYTHONPATH:../../azure-mgmt-notificationhubs -export PYTHONPATH=$PYTHONPATH:../../azure-mgmt-redis -export PYTHONPATH=$PYTHONPATH:../../azure-mgmt-resource -export PYTHONPATH=$PYTHONPATH:../../azure-mgmt-scheduler -export PYTHONPATH=$PYTHONPATH:../../azure-mgmt-storage -export PYTHONPATH=$PYTHONPATH:../../azure-mgmt-web -export PYTHONPATH=$PYTHONPATH:../../azure-graphrbac - -echo "Running tests..." -which coverage &> /dev/null -if [ $? -eq 0 ] -then - LAUNCHER='coverage run' -else - LAUNCHER='python' -fi -$LAUNCHER -m unittest discover -v -p "test_*.py" diff --git a/azure-mgmt/tests/run-mgmt.bat b/azure-mgmt/tests/run-mgmt.bat deleted file mode 100644 index cebaed36899b..000000000000 --- a/azure-mgmt/tests/run-mgmt.bat +++ /dev/null @@ -1,57 +0,0 @@ -@echo OFF -SETLOCAL -REM---------------------------------------------------------------------------- -REM Copyright (c) Microsoft. All rights reserved. -REM -REM Licensed under the Apache License, Version 2.0 (the "License"); -REM you may not use this file except in compliance with the License. -REM You may obtain a copy of the License at -REM http://www.apache.org/licenses/LICENSE-2.0 -REM -REM Unless required by applicable law or agreed to in writing, software -REM distributed under the License is distributed on an "AS IS" BASIS, -REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -REM See the License for the specific language governing permissions and -REM limitations under the License. -REM---------------------------------------------------------------------------- -cls - -if "%1%" == "" ( - set PYTHONDIR=%SystemDrive%\Python27 -) else ( - set PYTHONDIR=%1% -) - -if "%PYTHONPATH%" == "" ( - set PYTHONPATH=. -) -set PYTHONPATH=%PYTHONPATH%;..\..\azure-batch -set PYTHONPATH=%PYTHONPATH%;..\..\azure-common -set PYTHONPATH=%PYTHONPATH%;..\..\azure-mgmt -set PYTHONPATH=%PYTHONPATH%;..\..\azure-mgmt-common -set PYTHONPATH=%PYTHONPATH%;..\..\azure-mgmt-authorization -set PYTHONPATH=%PYTHONPATH%;..\..\azure-mgmt-batch -set PYTHONPATH=%PYTHONPATH%;..\..\azure-mgmt-cdn -set PYTHONPATH=%PYTHONPATH%;..\..\azure-mgmt-commerce -set PYTHONPATH=%PYTHONPATH%;..\..\azure-mgmt-compute -set PYTHONPATH=%PYTHONPATH%;..\..\azure-mgmt-logic -set PYTHONPATH=%PYTHONPATH%;..\..\azure-mgmt-network -set PYTHONPATH=%PYTHONPATH%;..\..\azure-mgmt-notificationhubs -set PYTHONPATH=%PYTHONPATH%;..\..\azure-mgmt-redis -set PYTHONPATH=%PYTHONPATH%;..\..\azure-mgmt-resource -set PYTHONPATH=%PYTHONPATH%;..\..\azure-mgmt-scheduler -set PYTHONPATH=%PYTHONPATH%;..\..\azure-mgmt-storage -set PYTHONPATH=%PYTHONPATH%;..\..\azure-mgmt-web -set PYTHONPATH=%PYTHONPATH%;..\..\azure-graphrbac - -echo Running tests using %PYTHONDIR% -%PYTHONDIR%\python.exe -m unittest discover -p "test_*.py" - - -set UNITTEST_EC=%ERRORLEVEL% -echo Finished running tests! - - -REM --------------------------------------------------------------------------- -:exit_door -exit /B %UNITTEST_EC% \ No newline at end of file diff --git a/azure-mgmt/tests/test_batch.py b/azure-mgmt/tests/test_batch.py index 613478b0540b..06914f2487db 100644 --- a/azure-mgmt/tests/test_batch.py +++ b/azure-mgmt/tests/test_batch.py @@ -48,7 +48,7 @@ LOG.level = logging.WARNING LOG.addHandler(logging.StreamHandler()) -def init_test_mode(working_folder): +def init_tst_mode(working_folder): try: path = os.path.join(working_folder, 'testsettings_local.json') with open(path) as testsettings_local_file: @@ -121,7 +121,7 @@ def setUpClass(cls): LOG.debug("Setting up Batch tests:") cls.working_folder = os.path.dirname(__file__) try: - cls.test_mode = init_test_mode(cls.working_folder) + cls.test_mode = init_tst_mode(cls.working_folder) cls.fake_settings = fake_settings if TestMode.is_playback(cls.test_mode): LOG.debug(" running in playback mode") diff --git a/azure-servicebus/tests/.coveragerc b/azure-servicebus/tests/.coveragerc deleted file mode 100644 index 9cbf999a25d8..000000000000 --- a/azure-servicebus/tests/.coveragerc +++ /dev/null @@ -1,4 +0,0 @@ -[run] -source = - ../azure -omit = */test* diff --git a/azure-servicebus/tests/run-servicebus b/azure-servicebus/tests/run-servicebus deleted file mode 100644 index e2752db1e97a..000000000000 --- a/azure-servicebus/tests/run-servicebus +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -export PYTHONPATH=$PYTHONPATH:../../azure-common -export PYTHONPATH=$PYTHONPATH:../../azure-servicebus - -echo "Running tests..." -which coverage &> /dev/null -if [ $? -eq 0 ] -then - LAUNCHER='coverage run' -else - LAUNCHER='python' -fi -$LAUNCHER -m unittest discover -p "test_servicebus_*.py" diff --git a/azure-servicebus/tests/run-servicebus.bat b/azure-servicebus/tests/run-servicebus.bat deleted file mode 100644 index 5873854a568b..000000000000 --- a/azure-servicebus/tests/run-servicebus.bat +++ /dev/null @@ -1,41 +0,0 @@ -@echo OFF -SETLOCAL -REM---------------------------------------------------------------------------- -REM Copyright (c) Microsoft. All rights reserved. -REM -REM Licensed under the Apache License, Version 2.0 (the "License"); -REM you may not use this file except in compliance with the License. -REM You may obtain a copy of the License at -REM http://www.apache.org/licenses/LICENSE-2.0 -REM -REM Unless required by applicable law or agreed to in writing, software -REM distributed under the License is distributed on an "AS IS" BASIS, -REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -REM See the License for the specific language governing permissions and -REM limitations under the License. -REM---------------------------------------------------------------------------- -cls - -if "%1%" == "" ( - set PYTHONDIR=%SystemDrive%\Python27 -) else ( - set PYTHONDIR=%1% -) - -if "%PYTHONPATH%" == "" ( - set PYTHONPATH=. -) -set PYTHONPATH=%PYTHONPATH%;..\..\azure-common -set PYTHONPATH=%PYTHONPATH%;..\..\azure-servicebus - -echo Running tests using %PYTHONDIR% -%PYTHONDIR%\python.exe -m unittest discover -p "test_servicebus_*.py" - - -set UNITTEST_EC=%ERRORLEVEL% -echo Finished running tests! - - -REM --------------------------------------------------------------------------- -:exit_door -exit /B %UNITTEST_EC% \ No newline at end of file diff --git a/azure-servicemanagement-legacy/tests/.coveragerc b/azure-servicemanagement-legacy/tests/.coveragerc deleted file mode 100644 index 9cbf999a25d8..000000000000 --- a/azure-servicemanagement-legacy/tests/.coveragerc +++ /dev/null @@ -1,4 +0,0 @@ -[run] -source = - ../azure -omit = */test* diff --git a/azure-servicemanagement-legacy/tests/run-legacy-mgmt b/azure-servicemanagement-legacy/tests/run-legacy-mgmt deleted file mode 100644 index ce9a50f91baa..000000000000 --- a/azure-servicemanagement-legacy/tests/run-legacy-mgmt +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -export PYTHONPATH=$PYTHONPATH:../../azure-common -export PYTHONPATH=$PYTHONPATH:../../azure-servicemanagement-legacy - -echo "Running tests..." -which coverage &> /dev/null -if [ $? -eq 0 ] -then - LAUNCHER='coverage run' -else - LAUNCHER='python' -fi -$LAUNCHER -m unittest discover -p "test_legacy_mgmt_*.py" diff --git a/azure-servicemanagement-legacy/tests/run-legacy-mgmt.bat b/azure-servicemanagement-legacy/tests/run-legacy-mgmt.bat deleted file mode 100644 index 08ecc7de19d4..000000000000 --- a/azure-servicemanagement-legacy/tests/run-legacy-mgmt.bat +++ /dev/null @@ -1,41 +0,0 @@ -@echo OFF -SETLOCAL -REM---------------------------------------------------------------------------- -REM Copyright (c) Microsoft. All rights reserved. -REM -REM Licensed under the Apache License, Version 2.0 (the "License"); -REM you may not use this file except in compliance with the License. -REM You may obtain a copy of the License at -REM http://www.apache.org/licenses/LICENSE-2.0 -REM -REM Unless required by applicable law or agreed to in writing, software -REM distributed under the License is distributed on an "AS IS" BASIS, -REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -REM See the License for the specific language governing permissions and -REM limitations under the License. -REM---------------------------------------------------------------------------- -cls - -if "%1%" == "" ( - set PYTHONDIR=%SystemDrive%\Python27 -) else ( - set PYTHONDIR=%1% -) - -if "%PYTHONPATH%" == "" ( - set PYTHONPATH=. -) -set PYTHONPATH=%PYTHONPATH%;..\..\azure-common -set PYTHONPATH=%PYTHONPATH%;..\..\azure-servicemanagement-legacy - -echo Running tests using %PYTHONDIR% -%PYTHONDIR%\python.exe -m unittest discover -p "test_legacy_mgmt_*.py" - - -set UNITTEST_EC=%ERRORLEVEL% -echo Finished running tests! - - -REM --------------------------------------------------------------------------- -:exit_door -exit /B %UNITTEST_EC% \ No newline at end of file diff --git a/azure_nosetests.py b/azure_nosetests.py new file mode 100644 index 000000000000..9778663724e1 --- /dev/null +++ b/azure_nosetests.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python + +import os.path, nose, glob, sys +packages = [os.path.dirname(p) for p in glob.glob('azure*/setup.py')] +sys.path += packages + +nose.main() \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 000000000000..74d64ce33f3f --- /dev/null +++ b/setup.cfg @@ -0,0 +1,4 @@ +[nosetests] +tests=azure-mgmt,azure-servicemanagement-legacy,azure-servicebus +with-coverage=1 +cover-erase=1 \ No newline at end of file