summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvar Lazzaro <ivarlazzaro@gmail.com>2014-09-26 19:35:38 -0700
committerIvar Lazzaro <ivarlazzaro@gmail.com>2014-10-17 17:52:39 -0700
commit15db2af2bbcdd2e2d09269339871b200b88721c3 (patch)
treed793eca4ea60c2ff8b508ae65338debcd28c253a
parent21fd205646003519e36f69602efad9ca38416bb2 (diff)
Repo Init
enables unit testing and heat dependency Change-Id: I51908e334b7ef3f0a2c200a1dae85de81e418a23
Notes
Notes (review): Verified+2: Jenkins Code-Review+2: Subrahmanyam Ongole <songole@oneconvergence.com> Code-Review+2: Hemanth Ravi <hemanth.ravi@oneconvergence.com> Workflow+1: Hemanth Ravi <hemanth.ravi@oneconvergence.com> Submitted-by: Jenkins Submitted-at: Tue, 21 Oct 2014 02:28:42 +0000 Reviewed-on: https://review.openstack.org/124559 Project: stackforge/group-based-policy-automation Branch: refs/heads/master
-rw-r--r--.coveragerc7
-rw-r--r--.gitignore21
-rw-r--r--.gitreview2
-rw-r--r--.mailmap3
-rw-r--r--.testr.conf7
-rw-r--r--CONTRIBUTING.rst17
-rw-r--r--HACKING.rst4
-rw-r--r--LICENSE175
-rw-r--r--MANIFEST.in6
-rw-r--r--README.rst15
-rw-r--r--babel.cfg1
-rwxr-xr-xdoc/source/conf.py75
-rw-r--r--doc/source/contributing.rst4
-rw-r--r--doc/source/index.rst24
-rw-r--r--doc/source/installation.rst12
-rw-r--r--doc/source/readme.rst1
-rw-r--r--doc/source/usage.rst7
-rw-r--r--gbpautomation/__init__.py17
-rw-r--r--gbpautomation/heat/__init__.py0
-rw-r--r--gbpautomation/heat/db/__init__.py0
-rw-r--r--gbpautomation/heat/db/sqlalchemy/__init__.py0
-rw-r--r--gbpautomation/heat/db/sqlalchemy/migrate_repo/__init__.py0
-rw-r--r--gbpautomation/heat/db/sqlalchemy/migrate_repo/versions/__init__.py0
-rw-r--r--gbpautomation/heat/tests/__init__.py0
-rw-r--r--gbpautomation/heat/tests/base.py23
-rw-r--r--gbpautomation/heat/tests/test_gbpautomation.py28
-rw-r--r--openstack-common.conf10
-rw-r--r--requirements.txt6
-rwxr-xr-xrun_tests.sh125
-rw-r--r--setup.cfg47
-rwxr-xr-xsetup.py22
-rw-r--r--test-requirements.txt20
-rw-r--r--tools/install_venv.py71
-rw-r--r--tools/install_venv_common.py172
-rwxr-xr-xtools/with_venv.sh4
-rw-r--r--tox.ini50
36 files changed, 975 insertions, 1 deletions
diff --git a/.coveragerc b/.coveragerc
new file mode 100644
index 0000000..3b796a5
--- /dev/null
+++ b/.coveragerc
@@ -0,0 +1,7 @@
1[run]
2branch = True
3source = gbpautomation
4omit = gbpautomation/tests/*,gbpautomation/openstack/*
5
6[report]
7ignore-errors = True \ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..45c6846
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,21 @@
1*.pyc
2*.swp
3*~
4build
5dist
6*.egg-info
7tags
8*.log
9heat-test.db
10heat.sqlite
11.venv
12AUTHORS
13ChangeLog
14templates/cloudformation-examples
15.tox
16.coverage
17.coverage.*
18cover
19.testrepository
20.project
21.pydevproject
diff --git a/.gitreview b/.gitreview
index 59fbb51..73e5fe6 100644
--- a/.gitreview
+++ b/.gitreview
@@ -1,4 +1,4 @@
1[gerrit] 1[gerrit]
2host=review.openstack.org 2host=review.openstack.org
3port=29418 3port=29418
4project=stackforge/group-based-policy-automation.git 4project=stackforge/group-based-policy-automation.git \ No newline at end of file
diff --git a/.mailmap b/.mailmap
new file mode 100644
index 0000000..cc92f17
--- /dev/null
+++ b/.mailmap
@@ -0,0 +1,3 @@
1# Format is:
2# <preferred e-mail> <other e-mail 1>
3# <preferred e-mail> <other e-mail 2> \ No newline at end of file
diff --git a/.testr.conf b/.testr.conf
new file mode 100644
index 0000000..fb62267
--- /dev/null
+++ b/.testr.conf
@@ -0,0 +1,7 @@
1[DEFAULT]
2test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
3 OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
4 OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
5 ${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION
6test_id_option=--load-list $IDFILE
7test_list_option=--list \ No newline at end of file
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
new file mode 100644
index 0000000..bacad4c
--- /dev/null
+++ b/CONTRIBUTING.rst
@@ -0,0 +1,17 @@
1If you would like to contribute to the development of OpenStack,
2you must follow the steps in the "If you're a developer, start here"
3section of this page:
4
5 http://wiki.openstack.org/HowToContribute
6
7Once those steps have been completed, changes to OpenStack
8should be submitted for review via the Gerrit tool, following
9the workflow documented at:
10
11 http://wiki.openstack.org/GerritWorkflow
12
13Pull requests submitted through GitHub will be ignored.
14
15Bugs should be filed on Launchpad, not GitHub:
16
17 https://bugs.launchpad.net/group-based-policy-automation \ No newline at end of file
diff --git a/HACKING.rst b/HACKING.rst
new file mode 100644
index 0000000..90d8d8d
--- /dev/null
+++ b/HACKING.rst
@@ -0,0 +1,4 @@
1group-based-policy-automation Style Commandments
2===============================================
3
4Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/ \ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..67db858
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,175 @@
1
2 Apache License
3 Version 2.0, January 2004
4 http://www.apache.org/licenses/
5
6 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
8 1. Definitions.
9
10 "License" shall mean the terms and conditions for use, reproduction,
11 and distribution as defined by Sections 1 through 9 of this document.
12
13 "Licensor" shall mean the copyright owner or entity authorized by
14 the copyright owner that is granting the License.
15
16 "Legal Entity" shall mean the union of the acting entity and all
17 other entities that control, are controlled by, or are under common
18 control with that entity. For the purposes of this definition,
19 "control" means (i) the power, direct or indirect, to cause the
20 direction or management of such entity, whether by contract or
21 otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 outstanding shares, or (iii) beneficial ownership of such entity.
23
24 "You" (or "Your") shall mean an individual or Legal Entity
25 exercising permissions granted by this License.
26
27 "Source" form shall mean the preferred form for making modifications,
28 including but not limited to software source code, documentation
29 source, and configuration files.
30
31 "Object" form shall mean any form resulting from mechanical
32 transformation or translation of a Source form, including but
33 not limited to compiled object code, generated documentation,
34 and conversions to other media types.
35
36 "Work" shall mean the work of authorship, whether in Source or
37 Object form, made available under the License, as indicated by a
38 copyright notice that is included in or attached to the work
39 (an example is provided in the Appendix below).
40
41 "Derivative Works" shall mean any work, whether in Source or Object
42 form, that is based on (or derived from) the Work and for which the
43 editorial revisions, annotations, elaborations, or other modifications
44 represent, as a whole, an original work of authorship. For the purposes
45 of this License, Derivative Works shall not include works that remain
46 separable from, or merely link (or bind by name) to the interfaces of,
47 the Work and Derivative Works thereof.
48
49 "Contribution" shall mean any work of authorship, including
50 the original version of the Work and any modifications or additions
51 to that Work or Derivative Works thereof, that is intentionally
52 submitted to Licensor for inclusion in the Work by the copyright owner
53 or by an individual or Legal Entity authorized to submit on behalf of
54 the copyright owner. For the purposes of this definition, "submitted"
55 means any form of electronic, verbal, or written communication sent
56 to the Licensor or its representatives, including but not limited to
57 communication on electronic mailing lists, source code control systems,
58 and issue tracking systems that are managed by, or on behalf of, the
59 Licensor for the purpose of discussing and improving the Work, but
60 excluding communication that is conspicuously marked or otherwise
61 designated in writing by the copyright owner as "Not a Contribution."
62
63 "Contributor" shall mean Licensor and any individual or Legal Entity
64 on behalf of whom a Contribution has been received by Licensor and
65 subsequently incorporated within the Work.
66
67 2. Grant of Copyright License. Subject to the terms and conditions of
68 this License, each Contributor hereby grants to You a perpetual,
69 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 copyright license to reproduce, prepare Derivative Works of,
71 publicly display, publicly perform, sublicense, and distribute the
72 Work and such Derivative Works in Source or Object form.
73
74 3. Grant of Patent License. Subject to the terms and conditions of
75 this License, each Contributor hereby grants to You a perpetual,
76 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 (except as stated in this section) patent license to make, have made,
78 use, offer to sell, sell, import, and otherwise transfer the Work,
79 where such license applies only to those patent claims licensable
80 by such Contributor that are necessarily infringed by their
81 Contribution(s) alone or by combination of their Contribution(s)
82 with the Work to which such Contribution(s) was submitted. If You
83 institute patent litigation against any entity (including a
84 cross-claim or counterclaim in a lawsuit) alleging that the Work
85 or a Contribution incorporated within the Work constitutes direct
86 or contributory patent infringement, then any patent licenses
87 granted to You under this License for that Work shall terminate
88 as of the date such litigation is filed.
89
90 4. Redistribution. You may reproduce and distribute copies of the
91 Work or Derivative Works thereof in any medium, with or without
92 modifications, and in Source or Object form, provided that You
93 meet the following conditions:
94
95 (a) You must give any other recipients of the Work or
96 Derivative Works a copy of this License; and
97
98 (b) You must cause any modified files to carry prominent notices
99 stating that You changed the files; and
100
101 (c) You must retain, in the Source form of any Derivative Works
102 that You distribute, all copyright, patent, trademark, and
103 attribution notices from the Source form of the Work,
104 excluding those notices that do not pertain to any part of
105 the Derivative Works; and
106
107 (d) If the Work includes a "NOTICE" text file as part of its
108 distribution, then any Derivative Works that You distribute must
109 include a readable copy of the attribution notices contained
110 within such NOTICE file, excluding those notices that do not
111 pertain to any part of the Derivative Works, in at least one
112 of the following places: within a NOTICE text file distributed
113 as part of the Derivative Works; within the Source form or
114 documentation, if provided along with the Derivative Works; or,
115 within a display generated by the Derivative Works, if and
116 wherever such third-party notices normally appear. The contents
117 of the NOTICE file are for informational purposes only and
118 do not modify the License. You may add Your own attribution
119 notices within Derivative Works that You distribute, alongside
120 or as an addendum to the NOTICE text from the Work, provided
121 that such additional attribution notices cannot be construed
122 as modifying the License.
123
124 You may add Your own copyright statement to Your modifications and
125 may provide additional or different license terms and conditions
126 for use, reproduction, or distribution of Your modifications, or
127 for any such Derivative Works as a whole, provided Your use,
128 reproduction, and distribution of the Work otherwise complies with
129 the conditions stated in this License.
130
131 5. Submission of Contributions. Unless You explicitly state otherwise,
132 any Contribution intentionally submitted for inclusion in the Work
133 by You to the Licensor shall be under the terms and conditions of
134 this License, without any additional terms or conditions.
135 Notwithstanding the above, nothing herein shall supersede or modify
136 the terms of any separate license agreement you may have executed
137 with Licensor regarding such Contributions.
138
139 6. Trademarks. This License does not grant permission to use the trade
140 names, trademarks, service marks, or product names of the Licensor,
141 except as required for reasonable and customary use in describing the
142 origin of the Work and reproducing the content of the NOTICE file.
143
144 7. Disclaimer of Warranty. Unless required by applicable law or
145 agreed to in writing, Licensor provides the Work (and each
146 Contributor provides its Contributions) on an "AS IS" BASIS,
147 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 implied, including, without limitation, any warranties or conditions
149 of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 PARTICULAR PURPOSE. You are solely responsible for determining the
151 appropriateness of using or redistributing the Work and assume any
152 risks associated with Your exercise of permissions under this License.
153
154 8. Limitation of Liability. In no event and under no legal theory,
155 whether in tort (including negligence), contract, or otherwise,
156 unless required by applicable law (such as deliberate and grossly
157 negligent acts) or agreed to in writing, shall any Contributor be
158 liable to You for damages, including any direct, indirect, special,
159 incidental, or consequential damages of any character arising as a
160 result of this License or out of the use or inability to use the
161 Work (including but not limited to damages for loss of goodwill,
162 work stoppage, computer failure or malfunction, or any and all
163 other commercial damages or losses), even if such Contributor
164 has been advised of the possibility of such damages.
165
166 9. Accepting Warranty or Additional Liability. While redistributing
167 the Work or Derivative Works thereof, You may choose to offer,
168 and charge a fee for, acceptance of support, warranty, indemnity,
169 or other liability obligations and/or rights consistent with this
170 License. However, in accepting such obligations, You may act only
171 on Your own behalf and on Your sole responsibility, not on behalf
172 of any other Contributor, and only if You agree to indemnify,
173 defend, and hold each Contributor harmless for any liability
174 incurred by, or claims asserted against, such Contributor by reason
175 of your accepting any such warranty or additional liability.
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..90f8a7a
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,6 @@
1include AUTHORS
2include ChangeLog
3exclude .gitignore
4exclude .gitreview
5
6global-exclude *.pyc \ No newline at end of file
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..ef68f56
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,15 @@
1===============================
2group-based-policy-automation
3===============================
4
5Group Based Policy Automation
6
7* Free software: Apache license
8* Documentation: http://docs.openstack.org/developer/group-based-policy-automation
9* Source: http://git.openstack.org/cgit/stackforge/group-based-policy-automation
10* Bugs: http://bugs.launchpad.net/group-based-policy-automation
11
12Features
13--------
14
15* TODO \ No newline at end of file
diff --git a/babel.cfg b/babel.cfg
new file mode 100644
index 0000000..efceab8
--- /dev/null
+++ b/babel.cfg
@@ -0,0 +1 @@
[python: **.py]
diff --git a/doc/source/conf.py b/doc/source/conf.py
new file mode 100755
index 0000000..b862e01
--- /dev/null
+++ b/doc/source/conf.py
@@ -0,0 +1,75 @@
1# -*- coding: utf-8 -*-
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
11# implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15import os
16import sys
17
18sys.path.insert(0, os.path.abspath('../..'))
19# -- General configuration ----------------------------------------------------
20
21# Add any Sphinx extension module names here, as strings. They can be
22# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
23extensions = [
24 'sphinx.ext.autodoc',
25 # 'sphinx.ext.intersphinx',
26 'oslosphinx'
27]
28
29# autodoc generation is a bit aggressive and a nuisance when doing heavy
30# text edit cycles.
31# execute "export SPHINX_DEBUG=1" in your terminal to disable
32
33# The suffix of source filenames.
34source_suffix = '.rst'
35
36# The master toctree document.
37master_doc = 'index'
38
39# General information about the project.
40project = u'group-based-policy-automation'
41copyright = u'2013, OpenStack Foundation'
42
43# If true, '()' will be appended to :func: etc. cross-reference text.
44add_function_parentheses = True
45
46# If true, the current module name will be prepended to all description
47# unit titles (such as .. function::).
48add_module_names = True
49
50# The name of the Pygments (syntax highlighting) style to use.
51pygments_style = 'sphinx'
52
53# -- Options for HTML output --------------------------------------------------
54
55# The theme to use for HTML and HTML Help pages. Major themes that come with
56# Sphinx are currently 'default' and 'sphinxdoc'.
57# html_theme_path = ["."]
58# html_theme = '_theme'
59# html_static_path = ['static']
60
61# Output file base name for HTML help builder.
62htmlhelp_basename = '%sdoc' % project
63
64# Grouping the document tree into LaTeX files. List of tuples
65# (source start file, target name, title, author, documentclass
66# [howto/manual]).
67latex_documents = [
68 ('index',
69 '%s.tex' % project,
70 u'%s Documentation' % project,
71 u'OpenStack Foundation', 'manual'),
72]
73
74# Example configuration for intersphinx: refer to the Python standard library.
75# intersphinx_mapping = {'http://docs.python.org/': None}
diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst
new file mode 100644
index 0000000..ed77c12
--- /dev/null
+++ b/doc/source/contributing.rst
@@ -0,0 +1,4 @@
1============
2Contributing
3============
4.. include:: ../../CONTRIBUTING.rst \ No newline at end of file
diff --git a/doc/source/index.rst b/doc/source/index.rst
new file mode 100644
index 0000000..0126656
--- /dev/null
+++ b/doc/source/index.rst
@@ -0,0 +1,24 @@
1.. group-based-policy-automation documentation master file, created by
2 sphinx-quickstart on Tue Jul 9 22:26:36 2013.
3 You can adapt this file completely to your liking, but it should at least
4 contain the root `toctree` directive.
5
6Welcome to group-based-policy-automation's documentation!
7========================================================
8
9Contents:
10
11.. toctree::
12 :maxdepth: 2
13
14 readme
15 installation
16 usage
17 contributing
18
19Indices and tables
20==================
21
22* :ref:`genindex`
23* :ref:`modindex`
24* :ref:`search`
diff --git a/doc/source/installation.rst b/doc/source/installation.rst
new file mode 100644
index 0000000..11a5309
--- /dev/null
+++ b/doc/source/installation.rst
@@ -0,0 +1,12 @@
1============
2Installation
3============
4
5At the command line::
6
7 $ pip install group-based-policy-automation
8
9Or, if you have virtualenvwrapper installed::
10
11 $ mkvirtualenv group-based-policy-automation
12 $ pip install group-based-policy-automation \ No newline at end of file
diff --git a/doc/source/readme.rst b/doc/source/readme.rst
new file mode 100644
index 0000000..38ba804
--- /dev/null
+++ b/doc/source/readme.rst
@@ -0,0 +1 @@
.. include:: ../../README.rst \ No newline at end of file
diff --git a/doc/source/usage.rst b/doc/source/usage.rst
new file mode 100644
index 0000000..dc2b7d0
--- /dev/null
+++ b/doc/source/usage.rst
@@ -0,0 +1,7 @@
1========
2Usage
3========
4
5To use group-based-policy-automation in a project::
6
7 import gbpautomation \ No newline at end of file
diff --git a/gbpautomation/__init__.py b/gbpautomation/__init__.py
new file mode 100644
index 0000000..c16d389
--- /dev/null
+++ b/gbpautomation/__init__.py
@@ -0,0 +1,17 @@
1# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
13import pbr.version
14
15
16__version__ = pbr.version.VersionInfo(
17 'gbpautomation').version_string()
diff --git a/gbpautomation/heat/__init__.py b/gbpautomation/heat/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/gbpautomation/heat/__init__.py
diff --git a/gbpautomation/heat/db/__init__.py b/gbpautomation/heat/db/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/gbpautomation/heat/db/__init__.py
diff --git a/gbpautomation/heat/db/sqlalchemy/__init__.py b/gbpautomation/heat/db/sqlalchemy/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/gbpautomation/heat/db/sqlalchemy/__init__.py
diff --git a/gbpautomation/heat/db/sqlalchemy/migrate_repo/__init__.py b/gbpautomation/heat/db/sqlalchemy/migrate_repo/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/gbpautomation/heat/db/sqlalchemy/migrate_repo/__init__.py
diff --git a/gbpautomation/heat/db/sqlalchemy/migrate_repo/versions/__init__.py b/gbpautomation/heat/db/sqlalchemy/migrate_repo/versions/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/gbpautomation/heat/db/sqlalchemy/migrate_repo/versions/__init__.py
diff --git a/gbpautomation/heat/tests/__init__.py b/gbpautomation/heat/tests/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/gbpautomation/heat/tests/__init__.py
diff --git a/gbpautomation/heat/tests/base.py b/gbpautomation/heat/tests/base.py
new file mode 100644
index 0000000..be940e5
--- /dev/null
+++ b/gbpautomation/heat/tests/base.py
@@ -0,0 +1,23 @@
1# -*- coding: utf-8 -*-
2
3# Copyright 2010-2011 OpenStack Foundation
4# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17
18import testtools
19
20
21class TestCase(testtools.TestCase):
22
23 """Test case base class for all unit tests."""
diff --git a/gbpautomation/heat/tests/test_gbpautomation.py b/gbpautomation/heat/tests/test_gbpautomation.py
new file mode 100644
index 0000000..3766c81
--- /dev/null
+++ b/gbpautomation/heat/tests/test_gbpautomation.py
@@ -0,0 +1,28 @@
1# -*- coding: utf-8 -*-
2
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15"""
16test_gbpautomation
17----------------------------------
18
19Tests for `gbpautomation` module.
20"""
21
22from gbpautomation.heat.tests import base
23
24
25class TestGbpautomation(base.TestCase):
26
27 def test_something(self):
28 pass
diff --git a/openstack-common.conf b/openstack-common.conf
new file mode 100644
index 0000000..efdf01f
--- /dev/null
+++ b/openstack-common.conf
@@ -0,0 +1,10 @@
1[DEFAULT]
2
3# The list of modules to copy from oslo-incubator.git
4module=install_venv_common
5module=install_venv
6module=with_venv
7module=test
8
9# The base module to hold the copy of openstack.common
10base=gbpautomation \ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..95137a6
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,6 @@
1# The order of packages is significant, because pip processes them in the order
2# of appearance. Changing the order has an impact on the overall integration
3# process, which may cause wedges in the gate later.
4
5pbr>=0.6,!=0.7,<1.0
6Babel>=1.3
diff --git a/run_tests.sh b/run_tests.sh
new file mode 100755
index 0000000..0484a61
--- /dev/null
+++ b/run_tests.sh
@@ -0,0 +1,125 @@
1#!/bin/bash
2
3BASE_DIR=`dirname $0`
4
5function usage {
6 echo "Usage: $0 [OPTION]..."
7 echo "Run Heat's test suite(s)"
8 echo ""
9 echo " -V, --virtual-env Use virtualenv. Install automatically if not present."
10 echo " (Default is to run tests in local environment)"
11 echo " -F, --force Force a clean re-build of the virtual environment. Useful when dependencies have been added."
12 echo " -f, --func Functional tests have been removed."
13 echo " -u, --unit Run unit tests (default when nothing specified)"
14 echo " -p, --pep8 Run flake8 and HACKING compliance check (default when nothing specified)"
15 echo " -P, --no-pep8 Don't run flake8 and HACKING compliance check"
16 echo " --all Run pep8 and unit tests"
17 echo " -c, --coverage Generate coverage report"
18 echo " -d, --debug Run tests with testtools instead of testr. This allows you to use the debugger."
19 echo " -h, --help Print this usage message"
20 exit
21}
22
23# must not assign -a as an option, needed for selecting custom attributes
24no_venv=1
25function process_option {
26 case "$1" in
27 -V|--virtual-env) no_venv=0;;
28 -F|--force) force=1;;
29 -f|--func) test_func=1;;
30 -u|--unit) test_unit=1;;
31 -p|--pep8) test_pep8=1;;
32 -P|--no-pep8) test_pep8=0;;
33 --all) test_unit=1; test_pep8=1;;
34 -c|--coverage) coverage=1;;
35 -d|--debug) debug=1;;
36 -h|--help) usage;;
37 *) args="$args $1"; test_unit=1;;
38 esac
39}
40
41venv=.venv
42with_venv=tools/with_venv.sh
43wrapper=""
44debug=0
45
46function run_tests {
47 echo 'Running tests'
48 # Remove any extraneous DB migrations
49 find gbpautomation/heat/db/sqlalchemy/migrate_repo/versions/ -name '*.pyc' -delete
50
51 if [ $debug -eq 1 ]; then
52 echo "Debugging..."
53 if [ "$args" = "" ]; then
54 # Default to running all tests if specific test is not
55 # provided.
56 testrargs="discover ./gbpautomation/heat/tests"
57 fi
58 ${wrapper} python -m testtools.run $args $testrargs
59
60 # Short circuit because all of the testr and coverage stuff
61 # below does not make sense when running testtools.run for
62 # debugging purposes.
63 return $?
64 fi
65
66 # Just run the test suites in current environment
67 if [ -n "$args" ] ; then
68 args="-t $args"
69 fi
70 ${wrapper} python setup.py testr --slowest $args
71}
72
73function run_pep8 {
74 echo "Running flake8..."
75 bash -c "${wrapper} flake8 ${flake8args}"
76}
77
78# run unit tests with pep8 when no arguments are specified
79# otherwise process CLI options
80if [[ $# == 0 ]]; then
81 test_pep8=1
82 test_unit=1
83else
84 for arg in "$@"; do
85 process_option $arg
86 done
87fi
88
89if [ "$no_venv" == 0 ]
90then
91 # Remove the virtual environment if --force used
92 if [ "$force" == 1 ]; then
93 echo "Cleaning virtualenv..."
94 rm -rf ${venv}
95 fi
96 if [ -e ${venv} ]; then
97 wrapper="${with_venv}"
98 else
99 # Automatically install the virtualenv
100 python tools/install_venv.py
101 wrapper="${with_venv}"
102 fi
103fi
104
105result=0
106
107# If functional or unit tests have been selected, run them
108if [ "$test_unit" == 1 ] || [ "$debug" == 1 ] ; then
109 run_tests
110 result=$?
111fi
112
113# Run pep8 if it was selected
114if [ "$test_pep8" == 1 ]; then
115 run_pep8
116fi
117
118# Generate coverage report
119if [ "$coverage" == 1 ]; then
120 echo "Generating coverage report in ./cover"
121 ${wrapper} python setup.py testr --coverage --slowest
122 ${wrapper} python -m coverage report --show-missing
123fi
124
125exit $result
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..28727cd
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,47 @@
1[metadata]
2name = group-based-policy-automation
3summary = Group Based Policy Automation
4description-file =
5 README.rst
6author = OpenStack
7author-email = openstack-dev@lists.openstack.org
8home-page = http://www.openstack.org/
9classifier =
10 Environment :: OpenStack
11 Intended Audience :: Information Technology
12 Intended Audience :: System Administrators
13 License :: OSI Approved :: Apache Software License
14 Operating System :: POSIX :: Linux
15 Programming Language :: Python
16 Programming Language :: Python :: 2
17 Programming Language :: Python :: 2.7
18 Programming Language :: Python :: 2.6
19 Programming Language :: Python :: 3
20 Programming Language :: Python :: 3.3
21 Programming Language :: Python :: 3.4
22
23[files]
24packages =
25 gbpautomation
26
27[build_sphinx]
28source-dir = doc/source
29build-dir = doc/build
30all_files = 1
31
32[upload_sphinx]
33upload-dir = doc/build/html
34
35[compile_catalog]
36directory = gbpautomation/locale
37domain = group-based-policy-automation
38
39[update_catalog]
40domain = group-based-policy-automation
41output_dir = gbpautomation/locale
42input_file = gbpautomation/locale/group-based-policy-automation.pot
43
44[extract_messages]
45keywords = _ gettext ngettext l_ lazy_gettext
46mapping_file = babel.cfg
47output_file = gbpautomation/locale/group-based-policy-automation.pot \ No newline at end of file
diff --git a/setup.py b/setup.py
new file mode 100755
index 0000000..70c2b3f
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,22 @@
1#!/usr/bin/env python
2# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
18import setuptools
19
20setuptools.setup(
21 setup_requires=['pbr'],
22 pbr=True)
diff --git a/test-requirements.txt b/test-requirements.txt
new file mode 100644
index 0000000..71095ed
--- /dev/null
+++ b/test-requirements.txt
@@ -0,0 +1,20 @@
1# The order of packages is significant, because pip processes them in the order
2# of appearance. Changing the order has an impact on the overall integration
3# process, which may cause wedges in the gate later.
4
5-e git://github.com/openstack/heat.git@stable/juno#egg=heat
6# Hacking already pins down pep8, pyflakes and flake8
7hacking>=0.8.0,<0.9
8coverage>=3.6
9discover
10lockfile>=0.8
11mock>=1.0
12mox>=0.5.3
13MySQL-python
14oslosphinx>=2.2.0 # Apache-2.0
15oslotest>=1.1.0 # Apache-2.0
16psycopg2
17sphinx>=1.1.2,!=1.2.0,<1.3
18testrepository>=0.0.18
19testscenarios>=0.4
20testtools>=0.9.34
diff --git a/tools/install_venv.py b/tools/install_venv.py
new file mode 100644
index 0000000..e96521e
--- /dev/null
+++ b/tools/install_venv.py
@@ -0,0 +1,71 @@
1# Copyright 2010 United States Government as represented by the
2# Administrator of the National Aeronautics and Space Administration.
3# All Rights Reserved.
4#
5# Copyright 2010 OpenStack Foundation
6# Copyright 2013 IBM Corp.
7#
8# Licensed under the Apache License, Version 2.0 (the "License"); you may
9# not use this file except in compliance with the License. You may obtain
10# a copy of the License at
11#
12# http://www.apache.org/licenses/LICENSE-2.0
13#
14# Unless required by applicable law or agreed to in writing, software
15# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17# License for the specific language governing permissions and limitations
18# under the License.
19
20import os
21import sys
22
23import install_venv_common as install_venv # noqa
24
25
26def print_help(venv, root):
27 help = """
28 OpenStack development environment setup is complete.
29
30 OpenStack development uses virtualenv to track and manage Python
31 dependencies while in development and testing.
32
33 To activate the OpenStack virtualenv for the extent of your current shell
34 session you can run:
35
36 $ source %s/bin/activate
37
38 Or, if you prefer, you can run commands in the virtualenv on a case by case
39 basis by running:
40
41 $ %s/tools/with_venv.sh <your command>
42
43 Also, make test will automatically use the virtualenv.
44 """
45 print(help % (venv, root))
46
47
48def main(argv):
49 root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
50
51 if os.environ.get('tools_path'):
52 root = os.environ['tools_path']
53 venv = os.path.join(root, '.venv')
54 if os.environ.get('venv'):
55 venv = os.environ['venv']
56
57 pip_requires = os.path.join(root, 'requirements.txt')
58 test_requires = os.path.join(root, 'test-requirements.txt')
59 py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1])
60 project = 'OpenStack'
61 install = install_venv.InstallVenv(root, venv, pip_requires, test_requires,
62 py_version, project)
63 options = install.parse_args(argv)
64 install.check_python_version()
65 install.check_dependencies()
66 install.create_virtualenv(no_site_packages=options.no_site_packages)
67 install.install_dependencies()
68 print_help(venv, root)
69
70if __name__ == '__main__':
71 main(sys.argv)
diff --git a/tools/install_venv_common.py b/tools/install_venv_common.py
new file mode 100644
index 0000000..e279159
--- /dev/null
+++ b/tools/install_venv_common.py
@@ -0,0 +1,172 @@
1# Copyright 2013 OpenStack Foundation
2# Copyright 2013 IBM Corp.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16"""Provides methods needed by installation script for OpenStack development
17virtual environments.
18
19Since this script is used to bootstrap a virtualenv from the system's Python
20environment, it should be kept strictly compatible with Python 2.6.
21
22Synced in from openstack-common
23"""
24
25from __future__ import print_function
26
27import optparse
28import os
29import subprocess
30import sys
31
32
33class InstallVenv(object):
34
35 def __init__(self, root, venv, requirements,
36 test_requirements, py_version,
37 project):
38 self.root = root
39 self.venv = venv
40 self.requirements = requirements
41 self.test_requirements = test_requirements
42 self.py_version = py_version
43 self.project = project
44
45 def die(self, message, *args):
46 print(message % args, file=sys.stderr)
47 sys.exit(1)
48
49 def check_python_version(self):
50 if sys.version_info < (2, 6):
51 self.die("Need Python Version >= 2.6")
52
53 def run_command_with_code(self, cmd, redirect_output=True,
54 check_exit_code=True):
55 """Runs a command in an out-of-process shell.
56
57 Returns the output of that command. Working directory is self.root.
58 """
59 if redirect_output:
60 stdout = subprocess.PIPE
61 else:
62 stdout = None
63
64 proc = subprocess.Popen(cmd, cwd=self.root, stdout=stdout)
65 output = proc.communicate()[0]
66 if check_exit_code and proc.returncode != 0:
67 self.die('Command "%s" failed.\n%s', ' '.join(cmd), output)
68 return (output, proc.returncode)
69
70 def run_command(self, cmd, redirect_output=True, check_exit_code=True):
71 return self.run_command_with_code(cmd, redirect_output,
72 check_exit_code)[0]
73
74 def get_distro(self):
75 if (os.path.exists('/etc/fedora-release') or
76 os.path.exists('/etc/redhat-release')):
77 return Fedora(
78 self.root, self.venv, self.requirements,
79 self.test_requirements, self.py_version, self.project)
80 else:
81 return Distro(
82 self.root, self.venv, self.requirements,
83 self.test_requirements, self.py_version, self.project)
84
85 def check_dependencies(self):
86 self.get_distro().install_virtualenv()
87
88 def create_virtualenv(self, no_site_packages=True):
89 """Creates the virtual environment and installs PIP.
90
91 Creates the virtual environment and installs PIP only into the
92 virtual environment.
93 """
94 if not os.path.isdir(self.venv):
95 print('Creating venv...', end=' ')
96 if no_site_packages:
97 self.run_command(['virtualenv', '-q', '--no-site-packages',
98 self.venv])
99 else:
100 self.run_command(['virtualenv', '-q', self.venv])
101 print('done.')
102 else:
103 print("venv already exists...")
104 pass
105
106 def pip_install(self, *args):
107 self.run_command(['tools/with_venv.sh',
108 'pip', 'install', '--upgrade'] + list(args),
109 redirect_output=False)
110
111 def install_dependencies(self):
112 print('Installing dependencies with pip (this can take a while)...')
113
114 # First things first, make sure our venv has the latest pip and
115 # setuptools and pbr
116 self.pip_install('pip>=1.4')
117 self.pip_install('setuptools')
118 self.pip_install('pbr')
119
120 self.pip_install('-r', self.requirements, '-r', self.test_requirements)
121
122 def parse_args(self, argv):
123 """Parses command-line arguments."""
124 parser = optparse.OptionParser()
125 parser.add_option('-n', '--no-site-packages',
126 action='store_true',
127 help="Do not inherit packages from global Python "
128 "install.")
129 return parser.parse_args(argv[1:])[0]
130
131
132class Distro(InstallVenv):
133
134 def check_cmd(self, cmd):
135 return bool(self.run_command(['which', cmd],
136 check_exit_code=False).strip())
137
138 def install_virtualenv(self):
139 if self.check_cmd('virtualenv'):
140 return
141
142 if self.check_cmd('easy_install'):
143 print('Installing virtualenv via easy_install...', end=' ')
144 if self.run_command(['easy_install', 'virtualenv']):
145 print('Succeeded')
146 return
147 else:
148 print('Failed')
149
150 self.die('ERROR: virtualenv not found.\n\n%s development'
151 ' requires virtualenv, please install it using your'
152 ' favorite package management tool' % self.project)
153
154
155class Fedora(Distro):
156 """This covers all Fedora-based distributions.
157
158 Includes: Fedora, RHEL, CentOS, Scientific Linux
159 """
160
161 def check_pkg(self, pkg):
162 return self.run_command_with_code(['rpm', '-q', pkg],
163 check_exit_code=False)[1] == 0
164
165 def install_virtualenv(self):
166 if self.check_cmd('virtualenv'):
167 return
168
169 if not self.check_pkg('python-virtualenv'):
170 self.die("Please install 'python-virtualenv'.")
171
172 super(Fedora, self).install_virtualenv()
diff --git a/tools/with_venv.sh b/tools/with_venv.sh
new file mode 100755
index 0000000..550c477
--- /dev/null
+++ b/tools/with_venv.sh
@@ -0,0 +1,4 @@
1#!/bin/bash
2TOOLS=`dirname $0`
3VENV=$TOOLS/../.venv
4source $VENV/bin/activate && "$@"
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..7f8ff8b
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,50 @@
1[tox]
2envlist = py26,py27,pep8
3minversion = 1.6
4skipsdist = True
5
6[testenv]
7# Note the hash seed is set to 0 until heat can be tested with a
8# random hash seed successfully.
9setenv = VIRTUAL_ENV={envdir}
10 PYTHONHASHSEED=0
11usedevelop = True
12install_command = pip install {opts} {packages}
13deps = -r{toxinidir}/requirements.txt
14 -r{toxinidir}/test-requirements.txt
15commands =
16 python setup.py testr --slowest --testr-args='^(?!functionaltests) {posargs}'
17
18whitelist_externals = bash
19
20[testenv:functional]
21commands =
22 python -c "print('TODO: functional tests')"
23
24[testenv:pep8]
25commands =
26 flake8
27 # Check that .po and .pot files are valid:
28 # bash -c "find gbpautomation -type f -regex '.*\.pot?' -print0|xargs -0 -n 1 msgfmt --check-format -o /dev/null"
29
30[testenv:venv]
31commands = {posargs}
32
33[testenv:cover]
34commands =
35 python setup.py testr --coverage --testr-args='{posargs}'
36
37[testenv:docs]
38deps = -r{toxinidir}/requirements.txt
39 -r{toxinidir}/test-requirements.txt
40 sphinxcontrib-httpdomain
41commands = python setup.py build_sphinx
42
43[flake8]
44# H302 import only modules.'bla..' does not import a module
45# H404 multi line docstring should start with a summary
46# H803 no full stop at the end of the commit message
47ignore = H302,H404,H803
48show-source = true
49builtins = _
50exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,tools,build