Skip to content

Commit

Permalink
Improve acceptance testing & fix bug when project id is empty (#7)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
yufeiminds authored Aug 21, 2019
1 parent ab6cfaa commit 71777ff
Show file tree
Hide file tree
Showing 172 changed files with 31,718 additions and 16,084 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,6 @@ venv.bak/
.idea/
.vscode/
~*

# UCloud
.migrate/
37 changes: 7 additions & 30 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,17 @@

language: python
python:
- 2.7
- 2.7
dist: xenial
sudo: true

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

# command to run tests, e.g. python setup.py test
script: tox
script:
- make lint
- make test-cov

before_deploy:
- pip install -e .[doc]
- make docs
- touch docs/build/html/.nojekyll

# deploy new versions to PyPI / GithubIO
deploy:
- provider: pages
skip_cleanup: true
github_token:
secure: "hmzSJF/l5S0Wg5gne0EMg4949kCge+FsicBdpTrfARS22cWfhuoBw4U2/1g68vk3CrCDCWjY1MeS8KSnIL7/T1QEgXtiSj218sUmbJqQrw2zJwQ5D+PSih9YkefAH8Gxhnm0y5XNY7WdtxE243eDNBSahhYUvtb7rIH47nCvCP+Hfqwbe6Uh8sFhXyJoBIG48I66GHJ6ogQdSxbeVErGhyOjnhcgLbEDSj9c0CxkqGzaMjLr0eCJyGk11K8cFiJYlk4pL+rDYh6ySq+5gGIUlCPWwDc0eED2SYfPmuKUf36A8M+zOFXmB2MBu05EgVQy8B8pkuaEANOV8/fzRr4tEJkG6rrnfbECCMjMHb5kVzrPKhjJ+YXpoG4nO7uvILVB3F8H521BhDtEFA3bU2h7ptb5fUsGWovbLbA+Od8B5R2l63GrdGO1tp6rDYsOevrs4yt/nSQnY/3Arj558tVYy4nUCBPQu9ERPh1fqSPGGJ137fTPtaqSI2HNLWDMbXhuStda4Jst8NUtrF52lXiPQ1blFwQ6OTFKzF2lGLpAmYJ+IbbmcVZrif7hS163/h1vbthtdQ3DiAre0Zhy+iKLdVqvkO+FbRkY9UaYC94/xdYNOegzfTlrQbehxALbkAdLfIYfQN09Jqg41H1bGzIak9VWTHgPbrpzThVTrLIwCJg="
local_dir: docs/build/html
on:
branch: master
repo: ucloud/ucloud-sdk-python2
python: 2.7
- provider: pypi
distributions: sdist bdist_wheel
skip_existing: true
user: ucloud
password:
secure: "t0uGtmntLkofMOwPHvaxhDnIEOsA/wgLejbq2Vf8yDueDpJ7mOhHsFEt7vn+PTFeilRf6N58z9P4eixMMxl6oDktSS1WbL5chaUtRljDeTBN8rL10lbalsc7nUFZL8VGKtf2XljhaSra+jcCGvTPaqEOisDiGJoNm6GPbyR9s+P2mfL0XDTwgyUMHpaG5LcvMU+zpns+uXHurBoCnQrstIah9ylrGnmIhNbN6fU2HLlhVaX9VB7QGwSxQuin3YkTdi1tFN7AToi2oMcg46mXRRf/K4jNTwPOEr0MYZ334PhFB1odaWidOObbxMiRudyGk3pTzH6NFxtgg6PviH999qgWgTBFwBjHvq1DkJatRGH/vDHmgE3t2yS2c1xE8Wgl9ONhUj8MOlaStDn9H4lhbuiT7754yS22ko4mvcxCrqzGqZSp2/vh9UyJ72YcqsvsqUPv5paSmSebsEPxCw3z646CuqGk5cPz3XGj4pxJdhqlvOV3Zl35O3mSRLkCfyNLOTfYsheAaK2sxtbcbJ5fPfQRLsvPdVtInmDBEACdHdVYJJSFw4em+gwnnLDGj74/nHJUAX781XetmWoyP9t5IP+cEuzhYApo4rO8JgaG7v/IZoXcl/h4tHsSev8PD6cqWx2vYIJFtMKej87YjbkU/RJEjQz5NychqL0U3FminTw="
on:
branch: master
tags: true
repo: ucloud/ucloud-sdk-python2
python: 2.7
after_success:
- bash <(curl -s https://codecov.io/bash)
24 changes: 11 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ endef
export BROWSER_PYSCRIPT
BROWSER := python -c "$$BROWSER_PYSCRIPT"

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

help:
@echo "clean - remove all build, test, coverage and Python artifacts"
Expand All @@ -35,19 +35,19 @@ test: clean
pytest

test-cov: clean
pytest --cov=ucloud
pytest --cov=ucloud/core tests/test_core

test-acc: clean
USDK_ACC=1 pytest --cov=ucloud
USDKACC=1 pytest --cov=ucloud

test-all: clean
tox

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

fmt:
@black ./ucloud
@black -l 80 ucloud tests examples

dev:
@pip install -e .[dev]
Expand Down Expand Up @@ -80,11 +80,9 @@ clean-test:

migrate:
git clone https://github.com/ucloud/ucloud-sdk-python3.git .migrate
python scripts/migrate.py --source .migrate/ucloud --output ucloud
python scripts/migrate.py --source .migrate/tests --output tests
PYTHONPATH=. python scripts/migrate --source .migrate/ucloud --output ucloud
PYTHONPATH=. python scripts/migrate --source .migrate/tests --output tests
PYTHONPATH=. python scripts/migrate --source .migrate/docs --output docs
PYTHONPATH=. python scripts/migrate --source .migrate/examples --output examples
PYTHONPATH=. python scripts/migrate --source .migrate/README.md --output README.md
rm -rf .migrate
black ucloud tests

gen:
ucloud-model sdk apis --lang python2 --type=public --template
${GENERATE_TEMPLATE_PATH} --output ./gen.sh
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-

<p align="center">
<img src="https://ucloud-sdk.dl.ufileos.com/logos%2Flogo-mini.png" />
</p>

<h1 align="center">UCloud SDK Python 2</h1>

<p align="center">
<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>
<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>
<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>
<a href="https://ucloud.github.io/ucloud-sdk-python2/"><img src="https://img.shields.io/badge/docs-passing-brightgreen.svg" alt="Doc Status"></a>
</p>

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

This client can run on Linux, macOS and Windows.

- Website: https://www.ucloud.cn/
- Free software: Apache 2.0 license
- [Documentation](https://ucloud.github.io/ucloud-sdk-python2/)
24 changes: 0 additions & 24 deletions README.rst

This file was deleted.

53 changes: 4 additions & 49 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,56 +1,11 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -*- coding: utf-8 -*-

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))


# -- Project information -----------------------------------------------------

project = 'ucloud-sdk-python2'
project = 'ucloud-sdk-python3'
copyright = '2019, ucloud'
author = 'ucloud'


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
]

# Add any paths that contain templates here, relative to this directory.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo',
'sphinx.ext.viewcode']
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
2 changes: 2 additions & 0 deletions docs/core.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

Core
====

Expand Down
2 changes: 2 additions & 0 deletions docs/helpers.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

Helpers
=======

Expand Down
5 changes: 3 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-

UCloud SDK Python 2
===================

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

This client can run on Linux, macOS and Windows. It requires Python 2.7 and
above.
This client can run on Linux, macOS and Windows.

- Website: https://www.ucloud.cn/
- Free software: Apache 2.0 license
Expand Down
2 changes: 2 additions & 0 deletions docs/quick_start.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

QuickStart
==========

Expand Down
56 changes: 32 additions & 24 deletions docs/services.rst
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
# -*- coding: utf-8 -*-

UCloud SDK Services
===================

UDPN
----
PathX
-----

.. autoclass:: ucloud.services.udpn.client.UDPNClient
.. autoclass:: ucloud.services.pathx.client.PathXClient
:members:

UAccount
StepFlow
--------

.. autoclass:: ucloud.services.uaccount.client.UAccountClient
.. autoclass:: ucloud.services.stepflow.client.StepFlowClient
:members:

UMem
----
UAccount
--------

.. autoclass:: ucloud.services.umem.client.UMemClient
.. autoclass:: ucloud.services.uaccount.client.UAccountClient
:members:

UDB
Expand All @@ -25,10 +27,10 @@ UDB
.. autoclass:: ucloud.services.udb.client.UDBClient
:members:

UPHost
------
UDPN
----

.. autoclass:: ucloud.services.uphost.client.UPHostClient
.. autoclass:: ucloud.services.udpn.client.UDPNClient
:members:

UDisk
Expand All @@ -37,33 +39,39 @@ UDisk
.. autoclass:: ucloud.services.udisk.client.UDiskClient
:members:

VPC
UHost
-----

.. autoclass:: ucloud.services.uhost.client.UHostClient
:members:

ULB
---

.. autoclass:: ucloud.services.vpc.client.VPCClient
.. autoclass:: ucloud.services.ulb.client.ULBClient
:members:

UNet
UMem
----

.. autoclass:: ucloud.services.unet.client.UNetClient
.. autoclass:: ucloud.services.umem.client.UMemClient
:members:

ULB
---
UNet
----

.. autoclass:: ucloud.services.ulb.client.ULBClient
.. autoclass:: ucloud.services.unet.client.UNetClient
:members:

PathX
-----
UPHost
------

.. autoclass:: ucloud.services.pathx.client.PathXClient
.. autoclass:: ucloud.services.uphost.client.UPHostClient
:members:

UHost
-----
VPC
---

.. autoclass:: ucloud.services.uhost.client.UHostClient
.. autoclass:: ucloud.services.vpc.client.VPCClient
:members:

2 changes: 2 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

Usage
=====

Expand Down
2 changes: 2 additions & 0 deletions examples/two-tier/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

# UCloud SDK Two-Tier Example

## What is the goal
Expand Down
1 change: 1 addition & 0 deletions examples/two-tier/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# -*- coding: utf-8 -*-
Loading

0 comments on commit 71777ff

Please sign in to comment.