Compare commits

..

7 Commits

Author SHA1 Message Date
Zuul
302c34b87f Merge "Update TOX/UPPER_CONSTRAINTS_FILE for stable/train" into stable/train 2019-11-04 08:14:21 +00:00
Zuul
a74cc618c3 Merge "Update .gitreview for stable/train" into stable/train 2019-11-04 08:14:20 +00:00
Zuul
3fa77818a9 Merge "Add Python 3 Train unit tests" into stable/train 2019-09-23 02:11:20 +00:00
Corey Bryant
7aeb3dea38 Add Python 3 Train unit tests
This is a mechanically generated patch to ensure unit testing is in place
for all of the Tested Runtimes for Train.

See the Train python3-updates goal document for details:
https://governance.openstack.org/tc/goals/train/python3-updates.html

Change-Id: Ia67bc92c85694a6be8eea65b9c4bb661ecc13b36
Story: #2005924
Task: #34214
(cherry picked from commit 9cd38596cd)
2019-09-20 19:37:38 +00:00
jacky06
7830bf7bce Replace git.openstack.org URLs with opendev.org URLs
Change-Id: Ia80a351665da5428d3c7c4cb518ecf0afc2ef8c1
(cherry picked from commit 1a98ae3101)
2019-09-20 19:37:11 +00:00
a081a1acb6 Update TOX/UPPER_CONSTRAINTS_FILE for stable/train
Update the URL to the upper-constraints file to point to the redirect
rule on releases.openstack.org so that anyone working on this branch
will switch to the correct upper-constraints list automatically when
the requirements repository branches.

Until the requirements repository has as stable/train branch, tests will
continue to use the upper-constraints list on master.

Change-Id: I19a6e10c3d0803cfc11b81e2141f2b3083315fe1
2019-09-20 17:40:37 +00:00
a9e75163d6 Update .gitreview for stable/train
Change-Id: I48d07172823c0a22032b0d7d4a298aa3ed51f214
2019-09-20 17:40:35 +00:00
18 changed files with 54 additions and 125 deletions

View File

@@ -2,3 +2,4 @@
host=review.opendev.org
port=29418
project=openstack/python-karborclient.git
defaultbranch=stable/train

View File

@@ -3,6 +3,7 @@
- check-requirements
- openstack-cover-jobs
- openstack-lower-constraints-jobs
- openstack-python3-victoria-jobs
- openstack-python-jobs
- openstack-python3-train-jobs
- openstackclient-plugin-jobs
- publish-openstack-docs-pti

View File

@@ -1,5 +1,5 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
sphinx>=2.0.0,!=2.1.0 # BSD
openstackdocstheme>=2.2.1 # Apache-2.0
sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD
openstackdocstheme>=1.18.1 # Apache-2.0

View File

@@ -48,7 +48,7 @@ add_function_parentheses = True
add_module_names = True
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'native'
pygments_style = 'sphinx'
# -- Options for HTML output --------------------------------------------------
@@ -59,9 +59,10 @@ html_theme = 'openstackdocs'
# html_static_path = ['static']
# openstackdocstheme options
openstackdocs_repo_name = 'openstack/python-karborclient'
openstackdocs_bug_project = 'python-karborclient'
openstackdocs_bug_tag = ''
repository_name = 'openstack/python-karborclient'
bug_project = 'python-karborclient'
bug_tag = ''
html_last_updated_fmt = '%Y-%m-%d %H:%M'
# Output file base name for HTML help builder.
htmlhelp_basename = '%sdoc' % project

View File

@@ -133,9 +133,9 @@ class ShellCommandTest(ShellTest):
def test_help(self):
required = [
r'.*?^usage: karbor',
r'.*?^\s+plan-create\s+Creates a plan.',
r'.*?^See "karbor help COMMAND" for help on a specific command',
'.*?^usage: karbor',
'.*?^\s+plan-create\s+Creates a plan.',
'.*?^See "karbor help COMMAND" for help on a specific command',
]
stdout, stderr = self.shell('help')
for r in required:
@@ -144,8 +144,8 @@ class ShellCommandTest(ShellTest):
def test_help_on_subcommand(self):
required = [
r'.*?^usage: karbor plan-create',
r'.*?^Creates a plan.',
'.*?^usage: karbor plan-create',
'.*?^Creates a plan.',
]
stdout, stderr = self.shell('help plan-create')
for r in required:
@@ -154,9 +154,9 @@ class ShellCommandTest(ShellTest):
def test_help_no_options(self):
required = [
r'.*?^usage: karbor',
r'.*?^\s+plan-create\s+Creates a plan',
r'.*?^See "karbor help COMMAND" for help on a specific command',
'.*?^usage: karbor',
'.*?^\s+plan-create\s+Creates a plan',
'.*?^See "karbor help COMMAND" for help on a specific command',
]
stdout, stderr = self.shell('')
for r in required:

View File

@@ -21,22 +21,6 @@ mock_request_return = ({}, {'operation_log': {}})
class OperationLogsTest(base.TestCaseShell):
@mock.patch('karborclient.common.http.HTTPClient.json_request')
def test_list_operation_logs(self, mock_request):
mock_request.return_value = mock_request_return
cs.operation_logs.list()
mock_request.assert_called_with(
'GET',
'/operation_logs', headers={})
@mock.patch('karborclient.common.http.HTTPClient.json_request')
def test_list_operation_logs_with_all_tenants(self, mock_request):
mock_request.return_value = mock_request_return
cs.operation_logs.list(search_opts={'all_tenants': 1})
mock_request.assert_called_with(
'GET',
'/operation_logs?all_tenants=1', headers={})
@mock.patch('karborclient.common.http.HTTPClient.json_request')
def test_list_operation_logs_with_marker_limit(self, mock_request):
mock_request.return_value = mock_request_return

View File

@@ -30,15 +30,6 @@ class QuotaClassesTest(base.TestCaseShell):
'/quota_classes/default',
data={'quota_class': {'plans': 50}}, headers={})
@mock.patch('karborclient.common.http.HTTPClient.json_request')
def test_quota_class_update_with_none(self, mock_request):
mock_request.return_value = mock_request_return
cs.quota_classes.update('default', {'plans': None})
mock_request.assert_called_with(
'PUT',
'/quota_classes/default',
data={'quota_class': {'plans': 50}}, headers={})
@mock.patch('karborclient.common.http.HTTPClient.json_request')
def test_show_quota_class(self, mock_request):
mock_request.return_value = mock_request_return
@@ -47,12 +38,3 @@ class QuotaClassesTest(base.TestCaseShell):
'GET',
'/quota_classes/default',
headers={})
@mock.patch('karborclient.common.http.HTTPClient.json_request')
def test_show_quota_class_with_headers(self, mock_request):
mock_request.return_value = mock_request_return
cs.quota_classes.get('default', session_id='fake_session_id')
mock_request.assert_called_with(
'GET',
'/quota_classes/default',
headers={'X-Configuration-Session': 'fake_session_id'})

View File

@@ -30,15 +30,6 @@ class QuotasTest(base.TestCaseShell):
'/quotas/{project_id}'.format(project_id=fakes.PROJECT_ID),
data={'quota': {'plans': 50}}, headers={})
@mock.patch('karborclient.common.http.HTTPClient.json_request')
def test_quota_update_with_none(self, mock_request):
mock_request.return_value = mock_request_return
cs.quotas.update(fakes.PROJECT_ID, {'plans': None})
mock_request.assert_called_with(
'PUT',
'/quotas/{project_id}'.format(project_id=fakes.PROJECT_ID),
data={'quota': {'plans': 50}}, headers={})
@mock.patch('karborclient.common.http.HTTPClient.json_request')
def test_show_quota(self, mock_request):
mock_request.return_value = mock_request_return
@@ -48,15 +39,6 @@ class QuotasTest(base.TestCaseShell):
'/quotas/{project_id}'.format(project_id=fakes.PROJECT_ID),
headers={})
@mock.patch('karborclient.common.http.HTTPClient.json_request')
def test_show_quota_with_headers(self, mock_request):
mock_request.return_value = mock_request_return
cs.quotas.get(fakes.PROJECT_ID, False, session_id='fake_session_id')
mock_request.assert_called_with(
'GET',
'/quotas/{project_id}'.format(project_id=fakes.PROJECT_ID),
headers={'X-Configuration-Session': 'fake_session_id'})
@mock.patch('karborclient.common.http.HTTPClient.json_request')
def test_show_quota_with_detail(self, mock_request):
mock_request.return_value = mock_request_return
@@ -76,13 +58,3 @@ class QuotasTest(base.TestCaseShell):
'/quotas/{project_id}/defaults'.format(
project_id=fakes.PROJECT_ID),
headers={})
@mock.patch('karborclient.common.http.HTTPClient.json_request')
def test_show_quota_default_with_headers(self, mock_request):
mock_request.return_value = mock_request_return
cs.quotas.defaults(fakes.PROJECT_ID, session_id='fake_session_id')
mock_request.assert_called_with(
'GET',
'/quotas/{project_id}/defaults'.format(
project_id=fakes.PROJECT_ID),
headers={'X-Configuration-Session': 'fake_session_id'})

View File

@@ -22,22 +22,6 @@ mock_request_return = ({}, {'trigger_info': {'name': 'fake_name'}})
class TriggersTest(base.TestCaseShell):
@mock.patch('karborclient.common.http.HTTPClient.json_request')
def test_list_triggers(self, mock_request):
mock_request.return_value = mock_request_return
cs.triggers.list()
mock_request.assert_called_with(
'GET',
'/triggers', headers={})
@mock.patch('karborclient.common.http.HTTPClient.json_request')
def test_list_triggers_with_all_tenants(self, mock_request):
mock_request.return_value = mock_request_return
cs.triggers.list(search_opts={'all_tenants': 1})
mock_request.assert_called_with(
'GET',
'/triggers?all_tenants=1', headers={})
@mock.patch('karborclient.common.http.HTTPClient.json_request')
def test_list_triggers_with_marker_limit(self, mock_request):
mock_request.return_value = mock_request_return
@@ -119,9 +103,3 @@ class TriggersTest(base.TestCaseShell):
data=body,
headers={}
)
def test_update_trigger_with_invalid_window(self):
trigger_id = '123'
self.assertRaises(exceptions.CommandError,
cs.triggers.update,
trigger_id, {'properties': {'window': 'fake'}})

View File

@@ -26,9 +26,6 @@ class QuotaClassManager(base.ManagerWithFind):
def update(self, class_name, data):
if "plans" in data and data["plans"] is None:
data["plans"] = 50
body = {"quota_class": data}
return self._update('/quota_classes/{class_name}'

View File

@@ -26,9 +26,6 @@ class QuotaManager(base.ManagerWithFind):
def update(self, project_id, data):
if "plans" in data and data["plans"] is None:
data["plans"] = 50
body = {"quota": data}
return self._update('/quotas/{project_id}'

View File

@@ -195,7 +195,7 @@ def do_plan_update(cs, args):
if args.name is not None:
data['name'] = args.name
if args.description is not None:
data['description'] = args.description
data['description'] = args.description
if args.resources is not None:
plan_resources = arg_utils.extract_resources(args)
data['resources'] = plan_resources
@@ -1357,7 +1357,7 @@ def _quota_set_pretty_show(quotas):
metavar='<plans>',
type=int,
default=None,
help='New value for the "plans" quota. The default value is 50.')
help='New value for the "plans" quota.')
def do_quota_update(cs, args):
"""Update the quotas for a project (Admin only)."""
project_id = args.tenant
@@ -1400,7 +1400,7 @@ def do_quota_class_show(cs, args):
metavar='<plans>',
type=int,
default=None,
help='New value for the "plans" quota. The default value is 50.')
help='New value for the "plans" quota.')
def do_quota_class_update(cs, args):
"""Update the quotas for a quota class (Admin only)."""
class_name = args.class_name

View File

@@ -36,6 +36,7 @@ msgpack-python==0.4.0
munch==2.1.0
netaddr==0.7.18
netifaces==0.10.4
openstackdocstheme==1.18.1
openstacksdk==0.11.2
os-client-config==1.28.0
os-service-types==1.2.0
@@ -75,6 +76,8 @@ rfc3986==0.3.1
simplejson==3.5.1
six==1.10.0
snowballstemmer==1.2.1
Sphinx==1.6.2
sphinxcontrib-websupport==1.0.1
stevedore==1.20.0
testrepository==0.0.18
testscenarios==0.4

View File

@@ -1,6 +0,0 @@
---
upgrade:
- |
Python 2.7 support has been dropped. Last release of python-karborclient
to support python 2.7 is OpenStack Train. The minimum version of Python now
supported is Python 3.6.

View File

@@ -6,7 +6,6 @@ description-file =
author = OpenStack
author-email = openstack-discuss@lists.openstack.org
home-page = https://docs.openstack.org/python-karborclient/latest/
python-requires = >=3.6
classifier =
Environment :: OpenStack
Intended Audience :: Information Technology
@@ -14,12 +13,16 @@ classifier =
License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
[global]
setup-hooks =
pbr.hooks.setup_hook
[files]
packages =
karborclient
@@ -87,3 +90,6 @@ input_file = karborclient/locale/karborclient.pot
keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg
output_file = karborclient/locale/karborclient.pot
[wheel]
universal = 1

View File

@@ -13,8 +13,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools
# In python < 2.7.4, a lazy loading of package `pbr` will break
# setuptools if some other modules registered functions in `atexit`.
# solution from: http://bugs.python.org/issue15881#msg170215
try:
import multiprocessing # noqa
except ImportError:
pass
setuptools.setup(
setup_requires=['pbr>=2.0.0'],
pbr=True)

View File

@@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking>=3.0,<3.1.0 # Apache-2.0
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
python-subunit>=1.0.0 # Apache-2.0/BSD

18
tox.ini
View File

@@ -1,18 +1,16 @@
[tox]
minversion = 3.1.1
envlist = py37,pypy,pep8
minversion = 2.0
envlist = py27,py37,pypy,pep8
skipsdist = True
ignore_basepython_conflict = True
[testenv]
basepython = python3
usedevelop = True
install_command = pip install {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/train}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
whitelist_externals = rm
@@ -21,33 +19,39 @@ commands =
python setup.py test --slowest --testr-args='{posargs}'
[testenv:pep8]
basepython = python3
commands = flake8
[testenv:venv]
basepython = python3
commands = {posargs}
[testenv:cover]
basepython = python3
commands =
python setup.py test --coverage --testr-args='{posargs}'
coverage report
[testenv:docs]
basepython = python3
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/train}
-r{toxinidir}/doc/requirements.txt
commands = sphinx-build -W -b html doc/source doc/build/html
[testenv:debug]
basepython = python3
commands = oslo_debug_helper -t karborclient/tests {posargs}
[flake8]
show-source = True
ignore = W504
ignore =
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools
[testenv:lower-constraints]
basepython = python3
deps =
-c{toxinidir}/lower-constraints.txt
-r{toxinidir}/test-requirements.txt