Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit 08eca25

Browse files
authored
Merge pull request #1 from Microsoft/feature/json_rpc_library
Adding json rpc library with tests, dev set up, and basic folder structure.
2 parents a06c4cd + ca77935 commit 08eca25

26 files changed

+535
-0
lines changed

doc/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
1. Install the dependencies via pip with the script below.
2+
```Shell
3+
python scripts/dev_setup.py
4+
5+
2. Add `<clone root>\src` to your PYTHONPATH environment variable:
6+
7+
#####Windows
8+
```BatchFile
9+
set PYTHONPATH=<clone root>\src;%PYTHONPATH%
10+
```
11+
#####OSX/Ubuntu (bash)
12+
```Shell
13+
export PYTHONPATH=<clone root>/src:${PYTHONPATH}
14+
15+
##Running Tests:
16+
####Command line
17+
#####Windows:
18+
Provided your PYTHONPATH was set correctly, you can run the tests from your `<root clone>` directory.
19+
20+
To test the common modules of the CLI:
21+
```BatchFile
22+
python -m unittest discover -s src/common/tests
23+
```
24+
25+
To test the scripter module of the CLI:
26+
```BatchFile
27+
python -m unittest discover -s src/mssqlscripter/mssql/scripter/tests
28+
```
29+
30+
Additionally, you can run tests for all CLI tools and common modules using the `Run_All_Tests.bat` script.

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
enum34==1.1.6
2+
pip==9.0.1
3+
setuptools==30.4.0

scripts/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Contributing
2+
3+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

scripts/Run_All_Tests

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
# --------------------------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# --------------------------------------------------------------------------------------------
6+
7+
python -m unittest discover -s ../src/common/tests
8+
python -m unittest discover -s ../src/mssql-scripter/mssql/scripter/tests

scripts/Run_All_Tests.bat

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@echo off
2+
3+
REM --------------------------------------------------------------------------------------------
4+
REM Copyright (c) Microsoft Corporation. All rights reserved.
5+
REM Licensed under the MIT License. See License.txt in the project root for license information.
6+
REM --------------------------------------------------------------------------------------------
7+
8+
python -m unittest discover -s ../src/common/tests
9+
python -m unittest discover -s ../src/mssql-scripter/mssql/scripter/tests

scripts/dev_setup.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------
5+
6+
from __future__ import print_function
7+
8+
import sys
9+
import os
10+
from subprocess import check_call, CalledProcessError
11+
12+
root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), '..', '..'))
13+
14+
def exec_command(command):
15+
try:
16+
print('Executing: ' + command)
17+
check_call(command.split(), cwd=root_dir)
18+
print()
19+
except CalledProcessError as err:
20+
print(err, file=sys.stderr)
21+
sys.exit(1)
22+
23+
print('Running dev setup...')
24+
print('Root directory \'{}\'\n'.format(root_dir))
25+
26+
# install general requirements
27+
exec_command('pip install -r requirements.txt')
28+
29+
print('Finished dev setup.')

src/common/HISTORY.rst

Whitespace-only changes.

src/common/MANIFEST.ini

Whitespace-only changes.

src/common/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Microsoft XPlat CLI common module
2+
=================================

src/common/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)