From 3e5105218976549a0a782f179bb358edfd4e89c9 Mon Sep 17 00:00:00 2001 From: Johan Stenberg Date: Fri, 19 Feb 2016 18:20:21 -0800 Subject: [PATCH 1/4] Add load_tests / __init__.py to the azure/cli/tests module to allow for simpler unit test discovery --- src/azure/cli/tests/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/azure/cli/tests/__init__.py diff --git a/src/azure/cli/tests/__init__.py b/src/azure/cli/tests/__init__.py new file mode 100644 index 00000000000..82d46fc1749 --- /dev/null +++ b/src/azure/cli/tests/__init__.py @@ -0,0 +1,12 @@ +from .test_argparse import Test_argparse + +from unittest import TestSuite + +test_cases = [Test_argparse] + +def load_tests(loader, tests, pattern): + suite = TestSuite() + for testclass in test_cases: + tests = loader.loadTestsFromTestCase(testclass) + suite.addTests(tests) + return suite From a1c3be88431146e3e37f0d8e9b548af529060e2d Mon Sep 17 00:00:00 2001 From: "Johan Stenberg (MSFT)" Date: Fri, 19 Feb 2016 18:57:39 -0800 Subject: [PATCH 2/4] Create configuring_your_machine.md --- Doc/configuring_your_machine.md | 72 +++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 Doc/configuring_your_machine.md diff --git a/Doc/configuring_your_machine.md b/Doc/configuring_your_machine.md new file mode 100644 index 00000000000..f51e4cb1f33 --- /dev/null +++ b/Doc/configuring_your_machine.md @@ -0,0 +1,72 @@ +Setting up your development environment +======================================== +The Azure Python CLI projects sources are located on GitHub (https://github.com/Azure/azure-cli/). In order to contribute to the project, you are expected to: +- Have a GitHub account. For Microsoft contributors, follow the guidelines on https://opensourcehub.microsoft.com/ to create, configure and link your account +- Fork the https://github.com/Azure/azure-cli/ repository into your private GitHub account +- Create pull requests against the httips://github.com/azure/azure-cli repository to get your code changes merged into the project repository. + +##Preparing your machine ++ Install Python 3.5.x from http://python.org. Please note that the version of Python that comes preinstalled on OSX is 2.7. ++ Clone your repository and check out the master branch ++ Create a new virtual environment “env” for Python 3.5 in the root of your clone. You can do this by running: + +Windows +```BatchFile +python.exe -m venv \env +``` +OSX/Ubuntu +```Shell +python –m venv /env +``` + ++ Activate the env virtual environment by running: + +Windows: +```BatchFile +\env\scripts\activate.bat +``` +OSX/Ubuntu (bash): +```Shell +. /env/bin/activate +``` + ++ Install the latest autorest generated azure sdk. +```Shell +python –m pip install azure==2.0.0a1 +``` ++ Add \src to your PYTHONPATH environment variable: + +Windows: +```BatchFile +set PYTHONPATH=\src;%PYTHONPATH% +``` +OSX/Ubuntu (bash): +```Shell +export PYTHONPATH=/src:${PYTHONPATH} +``` + +##Configuring your IDE +###Visual Studio (Windows only) ++ Install Python Tools for Visual Studio. As of 2/18/2016, the current version (PTVS 2.2) can be found here. ++ Open the azure-cli.pyproj project +You should now be able to launch your project by pressing F5/start debugging + +###Visual Studio Code (Any platform) +Experimental steps – still haven’t been able to get virtual environments to work well with VSCode ++ Install VS Code ++ Install (one of) the python extension(s) (https://marketplace.visualstudio.com/items?itemName=donjayamanne.python) +Debugging should now work (including stepping and setting breakpoints). + +The repo has a launch.json file that will launch the version of Python that is first on your path. + +##Running unit tests: + +###Command line: +If you have configured your PYTHONPATH correctly (see above), you should be able to run all unit tests by executing python -m unittest from your /src directory. + +###VS Code: + + +###Visual Studio + + From 3556fc93b131c551afe38b3472c641546ab90d80 Mon Sep 17 00:00:00 2001 From: Johan Stenberg Date: Sat, 27 Feb 2016 11:09:41 -0800 Subject: [PATCH 3/4] Undo addition of __init__.py for tests... --- src/azure/cli/tests/__init__.py | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 src/azure/cli/tests/__init__.py diff --git a/src/azure/cli/tests/__init__.py b/src/azure/cli/tests/__init__.py deleted file mode 100644 index 82d46fc1749..00000000000 --- a/src/azure/cli/tests/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -from .test_argparse import Test_argparse - -from unittest import TestSuite - -test_cases = [Test_argparse] - -def load_tests(loader, tests, pattern): - suite = TestSuite() - for testclass in test_cases: - tests = loader.loadTestsFromTestCase(testclass) - suite.addTests(tests) - return suite From feec1b1a4d6b41e77f157af83e80f0bc8191a932 Mon Sep 17 00:00:00 2001 From: Johan Stenberg Date: Sat, 27 Feb 2016 11:13:11 -0800 Subject: [PATCH 4/4] Change casing of doc folder --- {Doc => doc}/configuring_your_machine.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {Doc => doc}/configuring_your_machine.md (100%) diff --git a/Doc/configuring_your_machine.md b/doc/configuring_your_machine.md similarity index 100% rename from Doc/configuring_your_machine.md rename to doc/configuring_your_machine.md