UPPER_CONSTRAINTS_FILE is old name and deprecated
This allows to use upper-constraints file as more
readable way instead of UPPER_CONSTRAINTS_FILE=<lower-constraints file>.
Change-Id: Ic64ec2e5b6562de7ea901d62aab446c661d675e8
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.
Fix problems found.
Update local hacking checks for new flake8.
Change-Id: I6396403d0a62f5403fc5b7fb04b6ce790c332c84
Until now no unit tests have been executed in py37 environment. This
change fixes tox configuration to enable running these tests.
Change-Id: I63bc0309fe6b4b314be97d8fc1bd051d2119ea84
Even though there was a py36 test enabled in the gate, the tox.ini
configuration was not actually invoking the unit tests. This
change sets up the environment to allow tests to run.
As a result, a number of Python3 errors are uncovered and fixed.
Notably:
Python 3 does not have contextlib.nested, so reformatting using ,
file() is not in Python 3, so use io.open() instead
Use six.assertCountEqual(self, in tests
safe_decode:
subprocess.check_output returns in byte encoding, while default text
type str. safe_decode does the right thing by making sure string are not
bytes in python2 and python3
No ascci encoding:
python3 defaults to UTF-8 encoding, which is merely an extension to
ascii (default for python2).
test_json_plugin.py:
the file being opened in binary(wb) mode so python is expecting the
string in bytes.
Some of the refactoring should be revisited after we drop Python 2
support.
Change-Id: I62b46a2509c39201ca015ca7c269b2ea70c376c8
Story: 2005047
Task: 29547
Using "python setup.py check -r -s" method of checking the package has
been deprecated with the new recommendation to build the sdist and
wheel, then running "twine check" against the output.
Luckily, there is already a job that covers this that only runs when the
README, setup.py, or setup.cfg files change, making running this in the
pep8 job redundant. This covered by the test-release-openstack-python3
that is defined in the publish-to-pypi-python3 template.
More details can be found in this mailing list post:
http://lists.openstack.org/pipermail/openstack-dev/2018-October/136136.html
Change-Id: I8a08bba2d1f9f4223cbe632472e7b4fe6db90ac8
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
Use the six library to get monasca-agent to work with
python2.7 and python3.
Story: 2004148
Task: 27621
Change-Id: I0de315967dd5a745741fda0c53ce8cc85cda8cc5
Signed-off-by: Chuck Short <chucks@redhat.com>
According to Openstack summit session [1] stestr is maintained
project to which all Openstack projects should migrate.
Let's switch it then.
[1] https://etherpad.openstack.org/p/YVR-python-pti
Change-Id: Ifb460199c94d748988d4f0e836e90d1dd6f294bc
Signed-off-by: Chuck Short <chucks@redhat.com>
It is necessary to move from python2.7 to python3 for cover test as the
previous commit: I12967d5f5e707efe2b271b28bc7ea4b40e7f1c15
Change-Id: I207c1962e05dae5e45353d58faeb8615170b1163
We want to default to running all tox environments under python 3, so
set the basepython value in each environment.
We do not want to specify a minor version number, because we do not
want to have to update the file every time we upgrade python.
We do not want to set the override once in testenv, because that
breaks the more specific versions used in default environments like
py35 and py36.
Change-Id: I12967d5f5e707efe2b271b28bc7ea4b40e7f1c15
* set the maximum line length to 100
* cleaned up the codes for pep8
Depends-On: https://review.openstack.org/560844
Change-Id: Id548b78b673cce869ef8291bdb6b4f1367b383ed
Signed-off-by: Jui Chandwaskar <jchandwaskar@op5.com>
'pip install -U' ugrades specified packages, this is not necessary
since we use constraints, remove the parameter '-U' from the line.
With tools/tox_install.sh - which a previous change of mine removed -
the -U was not harmful, but with the current set up, it might cause
upgrades, so remove it.
Change-Id: I67288f12bc125c12d124cd1dcfeff5ec70975d48
We do not need tox_install.sh, pip can handle constraints itself
and install the project correctly. Thus update tox.ini and remove
the now obsolete tools/tox_install.sh file.
This follows https://review.openstack.org/#/c/508061 to remove
tools/tox_install.sh.
Change-Id: I31ec2045b0fe998fc82902d64e809b431cabc00c
Following commit makes enhancements to the
keystone handling inside monasca-agent:
* using generic password approach that abstracts from underlying
keystone version thus allows agent to be used seamlessly with
either v2.0 or v3. The only relevant part is the set of parameters
that one needs to supply to either monasca-reconfigure or agent.yaml
configuration file
* using keystone discovery - it simply means that agent will no longer
enforce particular keystone version but will allow keystoneauth
to pick the best match for given environment
Extra:
* extracted methods get_session and get_client utilize an aproach
presented above and can be used outside of monasca_agent.common.keystone
inside checks or detection plugins
* make imports to import only modules instead specific objects
* removed some redundant methods
Story: 2000995
Task: 4191
Needed-By: I579f6bcd5975a32af2a255be41c9b6c4043fa1dc
Needed-By: Ifee5b88ccb632222310aafb1081ecb9c9d085150
Change-Id: Iec97e50089ed31ae7ad8244b37cec128817871a5
Enforce following codestyle rules:
* no xrange
* no LOG.warn usage (deprecated in favour of LOG.warning)
* usage of assertTrue(x) instead assertEqual(True, x)
* usage of assertIsNone(x) instead assertEqual(None, x)
* usage of assertIsNotNone(x) instead assertNotEqual(None, x) or assertIsNot(None, x)
Change-Id: Ie60ffc054d9c59b8ca6912c8552c0f5ec33ec696
- Add monasca_setup to the target of flake8
- Add coverage for monasca_setup
- Fix code style of monasca_setup with flake8
Change-Id: I67ac65e95289e9cb5c8e3cb7655d416c69c2ec05
Following commit does several things:
* changes nose to ostestr
* enables coverage
* adds flake8 for tests
* adds bandit
Bandit note:
Multiple asserts of bandit had to be disabled at this
point because fixing them was not obvious. Several simple
asserts like B110 [try_except_pass] were fixed with
Closes-Bug: #1628740
Change-Id: I640857349008178e8a6f565e31ca2fde26ce8da7
Adding constraints support to clients is slightly more complex than
services as the clients themselves are listed in upper-constraints.txt
which leads to errors that you can't install a specific version and a
constrained version.
This change adds constraints support by also adding a helper script to
edit the constraints to remove monasca-agent. It also uncaps psutil
which is a temporary workaround for monasca-agent until it is uncapped
globally.
Change-Id: Ib56d758e1b6fd6200eace660fc123f147dbdea18
Remove options -w and -e. Both those options throws an error:
nosetests: error: no such option: -w
Run nosetest in a specified dir and add verbose option.
Change-Id: I20c2b95431f755222ae523f5cc0ef217ff157c6c
On freshly installed Ubuntu Xenial, tox -e pep8 failed:
Supervisor requires Python 2.4 or later but does not work
on any version of Python 3
Not sure what causes tox to create the venv using py3, but this
patch forces it to do the right thing.
Change-Id: Iac8ced2b86f32276fcf98506bca8969c5fd0bdd4
Add an other-requirements.txt file containing a cross-platform list
of dependencies needed for running included tox-based tests. Also
include a tox environment for convenience calling the bindep[*] utility to
list any missing system requirements.
This change is self-testing.
For other-requirements.txt see also
http://docs.openstack.org/infra/manual/drivers.html#package-requirements
[*] http://docs.openstack.org/infra/bindep/
Change-Id: I954b79afd4a9d54488d5f4e0f5cab3cf82ce0407
This review is to prepare for adding monasca-agent into openstack
global-requirements. After this project gets into global requirements,
it will be in upper-constraints.txt. If we make changes on this
specific project, we need to replace it in the upper-constraints with
source based specifier before applying it to pip install.
Change-Id: Id4d6dc8648285c9131f7b4626524742f271e9f26
Add upper-constraints and min tox version.
This will prevent taking in packages that
are greater then what is defined in the
upper-constraints
Change-Id: Id557b9c47abf275de83516ccecd2d1b3eb0cfdd5
Python 2.6 support would be dropped by
Infra team from mitaka,CI would no longer be testing it,
so projects should drop it too.
Change-Id: I1bf12cd4105abef9db710eb7e065acba924766b8
Bring over the cleaning line from run_tests.sh for the pyc files to
all the tox runs.
This should eliminate the need to clean -x -i to kill pyc files in
your local directory to get tests to pass.
Change-Id: Id236061c60ed5558459ef67752e0f504c5818b5c
Closes-Bug: #1368661
Cleaned up all but four of the pep8 violations
E501 Line length > 80 characters
F401 module imported but unused
H302 import only modules (DEPRECATED)
H904 Wrap long lines in parentheses instead of a backslash (DEPRECATED)
Change-Id: Id24bff6c5f8b8630a9495f49983324342841866f