Skip to content

Commit 71777ff

Browse files
authored
Improve acceptance testing & fix bug when project id is empty (#7)
FEATURE: - Add testing framework supported `scenario` and `step`, inspire by *ThoughtWorks, Guage* - Add parameters encoding for array on general invoking ENHANCEMENT: - Add test scenario and improve the testing framework - Improve continuous deployment workflow, integration on a private cluster - Add unit testing cases to improving line coverage at core modules BUGFIX: - Fix unexpected error when project id is empty
1 parent ab6cfaa commit 71777ff

File tree

172 files changed

+31718
-16084
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+31718
-16084
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,6 @@ venv.bak/
107107
.idea/
108108
.vscode/
109109
~*
110+
111+
# UCloud
112+
.migrate/

.travis.yml

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,17 @@
22

33
language: python
44
python:
5-
- 2.7
5+
- 2.7
66
dist: xenial
77
sudo: true
88

99
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
10-
install: pip install -U tox-travis
10+
install: pip install -e .[ci]
1111

1212
# command to run tests, e.g. python setup.py test
13-
script: tox
13+
script:
14+
- make lint
15+
- make test-cov
1416

15-
before_deploy:
16-
- pip install -e .[doc]
17-
- make docs
18-
- touch docs/build/html/.nojekyll
19-
20-
# deploy new versions to PyPI / GithubIO
21-
deploy:
22-
- provider: pages
23-
skip_cleanup: true
24-
github_token:
25-
secure: "hmzSJF/l5S0Wg5gne0EMg4949kCge+FsicBdpTrfARS22cWfhuoBw4U2/1g68vk3CrCDCWjY1MeS8KSnIL7/T1QEgXtiSj218sUmbJqQrw2zJwQ5D+PSih9YkefAH8Gxhnm0y5XNY7WdtxE243eDNBSahhYUvtb7rIH47nCvCP+Hfqwbe6Uh8sFhXyJoBIG48I66GHJ6ogQdSxbeVErGhyOjnhcgLbEDSj9c0CxkqGzaMjLr0eCJyGk11K8cFiJYlk4pL+rDYh6ySq+5gGIUlCPWwDc0eED2SYfPmuKUf36A8M+zOFXmB2MBu05EgVQy8B8pkuaEANOV8/fzRr4tEJkG6rrnfbECCMjMHb5kVzrPKhjJ+YXpoG4nO7uvILVB3F8H521BhDtEFA3bU2h7ptb5fUsGWovbLbA+Od8B5R2l63GrdGO1tp6rDYsOevrs4yt/nSQnY/3Arj558tVYy4nUCBPQu9ERPh1fqSPGGJ137fTPtaqSI2HNLWDMbXhuStda4Jst8NUtrF52lXiPQ1blFwQ6OTFKzF2lGLpAmYJ+IbbmcVZrif7hS163/h1vbthtdQ3DiAre0Zhy+iKLdVqvkO+FbRkY9UaYC94/xdYNOegzfTlrQbehxALbkAdLfIYfQN09Jqg41H1bGzIak9VWTHgPbrpzThVTrLIwCJg="
26-
local_dir: docs/build/html
27-
on:
28-
branch: master
29-
repo: ucloud/ucloud-sdk-python2
30-
python: 2.7
31-
- provider: pypi
32-
distributions: sdist bdist_wheel
33-
skip_existing: true
34-
user: ucloud
35-
password:
36-
secure: "t0uGtmntLkofMOwPHvaxhDnIEOsA/wgLejbq2Vf8yDueDpJ7mOhHsFEt7vn+PTFeilRf6N58z9P4eixMMxl6oDktSS1WbL5chaUtRljDeTBN8rL10lbalsc7nUFZL8VGKtf2XljhaSra+jcCGvTPaqEOisDiGJoNm6GPbyR9s+P2mfL0XDTwgyUMHpaG5LcvMU+zpns+uXHurBoCnQrstIah9ylrGnmIhNbN6fU2HLlhVaX9VB7QGwSxQuin3YkTdi1tFN7AToi2oMcg46mXRRf/K4jNTwPOEr0MYZ334PhFB1odaWidOObbxMiRudyGk3pTzH6NFxtgg6PviH999qgWgTBFwBjHvq1DkJatRGH/vDHmgE3t2yS2c1xE8Wgl9ONhUj8MOlaStDn9H4lhbuiT7754yS22ko4mvcxCrqzGqZSp2/vh9UyJ72YcqsvsqUPv5paSmSebsEPxCw3z646CuqGk5cPz3XGj4pxJdhqlvOV3Zl35O3mSRLkCfyNLOTfYsheAaK2sxtbcbJ5fPfQRLsvPdVtInmDBEACdHdVYJJSFw4em+gwnnLDGj74/nHJUAX781XetmWoyP9t5IP+cEuzhYApo4rO8JgaG7v/IZoXcl/h4tHsSev8PD6cqWx2vYIJFtMKej87YjbkU/RJEjQz5NychqL0U3FminTw="
37-
on:
38-
branch: master
39-
tags: true
40-
repo: ucloud/ucloud-sdk-python2
41-
python: 2.7
17+
after_success:
18+
- bash <(curl -s https://codecov.io/bash)

Makefile

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ endef
1313
export BROWSER_PYSCRIPT
1414
BROWSER := python -c "$$BROWSER_PYSCRIPT"
1515

16-
# UCloud Tools
17-
GENERATE_TEMPLATE_PATH=../ucloud-api-model-v2/apisdk/lang/python/templates/bash.tpl
16+
# UCloud Tools Path
17+
UCLOUD_TEMPLATE_PATH=../ucloud-api-model-v2/apisdk/lang/python/templates
1818

1919
help:
2020
@echo "clean - remove all build, test, coverage and Python artifacts"
@@ -35,19 +35,19 @@ test: clean
3535
pytest
3636

3737
test-cov: clean
38-
pytest --cov=ucloud
38+
pytest --cov=ucloud/core tests/test_core
3939

4040
test-acc: clean
41-
USDK_ACC=1 pytest --cov=ucloud
41+
USDKACC=1 pytest --cov=ucloud
4242

4343
test-all: clean
4444
tox
4545

4646
lint:
47-
black --check ucloud/
47+
@flake8 --exclude=ucloud/services ucloud --ignore=E501,F401
4848

4949
fmt:
50-
@black ./ucloud
50+
@black -l 80 ucloud tests examples
5151

5252
dev:
5353
@pip install -e .[dev]
@@ -80,11 +80,9 @@ clean-test:
8080

8181
migrate:
8282
git clone https://github.com/ucloud/ucloud-sdk-python3.git .migrate
83-
python scripts/migrate.py --source .migrate/ucloud --output ucloud
84-
python scripts/migrate.py --source .migrate/tests --output tests
83+
PYTHONPATH=. python scripts/migrate --source .migrate/ucloud --output ucloud
84+
PYTHONPATH=. python scripts/migrate --source .migrate/tests --output tests
85+
PYTHONPATH=. python scripts/migrate --source .migrate/docs --output docs
86+
PYTHONPATH=. python scripts/migrate --source .migrate/examples --output examples
87+
PYTHONPATH=. python scripts/migrate --source .migrate/README.md --output README.md
8588
rm -rf .migrate
86-
black ucloud tests
87-
88-
gen:
89-
ucloud-model sdk apis --lang python2 --type=public --template
90-
${GENERATE_TEMPLATE_PATH} --output ./gen.sh

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# -*- coding: utf-8 -*-
2+
3+
<p align="center">
4+
<img src="https://ucloud-sdk.dl.ufileos.com/logos%2Flogo-mini.png" />
5+
</p>
6+
7+
<h1 align="center">UCloud SDK Python 2</h1>
8+
9+
<p align="center">
10+
<a href="https://pypi.python.org/pypi/ucloud-sdk-python2/"><img src="https://img.shields.io/pypi/v/ucloud-sdk-python2.svg" alt="Latest Stable Version"></a>
11+
<a href="https://travis-ci.org/ucloud/ucloud-sdk-python2"><img src="https://travis-ci.org/ucloud/ucloud-sdk-python2.svg?branch=master" alt="Travis CI Status"></a>
12+
<a href="https://codecov.io/github/ucloud/ucloud-sdk-python2?branch=master"><img src="https://codecov.io/github/ucloud/ucloud-sdk-python2/coverage.svg?branch=master" alt="Codecov Status"></a>
13+
<a href="https://ucloud.github.io/ucloud-sdk-python2/"><img src="https://img.shields.io/badge/docs-passing-brightgreen.svg" alt="Doc Status"></a>
14+
</p>
15+
16+
UCloud SDK is a Python client library for accessing the UCloud API.
17+
18+
This client can run on Linux, macOS and Windows.
19+
20+
- Website: https://www.ucloud.cn/
21+
- Free software: Apache 2.0 license
22+
- [Documentation](https://ucloud.github.io/ucloud-sdk-python2/)

README.rst

Lines changed: 0 additions & 24 deletions
This file was deleted.

docs/conf.py

Lines changed: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,11 @@
1-
# Configuration file for the Sphinx documentation builder.
2-
#
3-
# This file only contains a selection of the most common options. For a full
4-
# list see the documentation:
5-
# http://www.sphinx-doc.org/en/master/config
1+
# -*- coding: utf-8 -*-
62

7-
# -- Path setup --------------------------------------------------------------
8-
9-
# If extensions (or modules to document with autodoc) are in another directory,
10-
# add these directories to sys.path here. If the directory is relative to the
11-
# documentation root, use os.path.abspath to make it absolute, like shown here.
12-
#
13-
# import os
14-
# import sys
15-
# sys.path.insert(0, os.path.abspath('.'))
16-
17-
18-
# -- Project information -----------------------------------------------------
19-
20-
project = 'ucloud-sdk-python2'
3+
project = 'ucloud-sdk-python3'
214
copyright = '2019, ucloud'
225
author = 'ucloud'
23-
24-
25-
# -- General configuration ---------------------------------------------------
26-
27-
# Add any Sphinx extension module names here, as strings. They can be
28-
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
29-
# ones.
30-
extensions = [
31-
'sphinx.ext.autodoc',
32-
'sphinx.ext.doctest',
33-
'sphinx.ext.todo',
34-
'sphinx.ext.viewcode',
35-
]
36-
37-
# Add any paths that contain templates here, relative to this directory.
6+
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo',
7+
'sphinx.ext.viewcode']
388
templates_path = ['_templates']
39-
40-
# List of patterns, relative to source directory, that match files and
41-
# directories to ignore when looking for source files.
42-
# This pattern also affects html_static_path and html_extra_path.
439
exclude_patterns = []
44-
45-
46-
# -- Options for HTML output -------------------------------------------------
47-
48-
# The theme to use for HTML and HTML Help pages. See the documentation for
49-
# a list of builtin themes.
50-
#
5110
html_theme = 'alabaster'
52-
53-
# Add any paths that contain custom static files (such as style sheets) here,
54-
# relative to this directory. They are copied after the builtin static files,
55-
# so a file named "default.css" will overwrite the builtin "default.css".
5611
html_static_path = ['_static']

docs/core.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
13
Core
24
====
35

docs/helpers.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
13
Helpers
24
=======
35

docs/index.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
# -*- coding: utf-8 -*-
2+
13
UCloud SDK Python 2
24
===================
35

46
UCloud SDK is a Python client library for accessing the UCloud API.
57

6-
This client can run on Linux, macOS and Windows. It requires Python 2.7 and
7-
above.
8+
This client can run on Linux, macOS and Windows.
89

910
- Website: https://www.ucloud.cn/
1011
- Free software: Apache 2.0 license

docs/quick_start.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
13
QuickStart
24
==========
35

0 commit comments

Comments
 (0)