Commit Graph

51 Commits

Author SHA1 Message Date
Hasan Acar 7c42c56f1f fix: Making the gates happy
Change-Id: Iddf3469f07486f2c58b46ea993547eecd6df3382
2024-04-16 11:51:48 +00:00
LiZekun 29be6e96a6 Update python testing classifier
Yoga testing runtime[1] has been updated to add py39
testing as voting. Unit tests update are handled by the
job template change in openstack-zuul-job

- https://review.opendev.org/c/openstack/openstack-zuul-jobs/+/820286

this commit updates the classifier in setup.cfg file.

[1] https://governance.openstack.org/tc/reference/runtimes/yoga.html

Change-Id: Idb98e3b64528bb5ad12e7292bfb18c159585f87b
2022-04-04 09:20:29 +00:00
LiZekun fa8888abf7 Use TOX_CONSTRAINTS_FILE
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
2022-03-02 11:49:53 +00:00
likui a58ef361ac bump py37 to py38 in tox.ini
in 'victoria' cycle, we should test py38 by default.

[1] https://governance.openstack.org/tc/reference/runtimes/victoria.html

Change-Id: Iec7a658061c30f9e445ba27bfab584c93d0355bd
2020-10-14 09:13:04 +08:00
Andreas Jaeger cedadccc6f Update hacking for Python3
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
2020-03-31 06:49:33 +00:00
Witek Bedyk 38a91f0621 Enable running unit tests in py37 environment
Until now no unit tests have been executed in py37 environment. This
change fixes tox configuration to enable running these tests.

Change-Id: I63bc0309fe6b4b314be97d8fc1bd051d2119ea84
2019-11-26 10:01:35 +01:00
Ghanshyam Mann c57f201c7c [ussuri][goal] Drop python 2.7 support and testing
OpenStack is dropping the py2.7 support in ussuri cycle.

monasca-agent is ready with python 3 and ok to drop the
python 2.7 support.

Complete discussion & schedule can be found in
- http://lists.openstack.org/pipermail/openstack-discuss/2019-October/010142.html
- https://etherpad.openstack.org/p/drop-python2-support

Ussuri Communtiy-wide goal:
https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html

Depends-On: https://review.opendev.org/#/c/693631/
Change-Id: I6cd8c92e4c7c9228ae14596e1535f40184a5ae22
2019-11-16 14:09:24 +00:00
pengyuesheng c0f6f0b2f6 Update the constraints url
For more detail, see http://lists.openstack.org/pipermail/openstack-discuss/2019-May/006478.html

Change-Id: I92f3c33ff9e81158da52566f6111bccadd4028ae
2019-09-26 14:15:58 +08:00
Zuul ebc8eb843e Merge "Enable unit tests for py36" 2019-07-22 15:03:24 +00:00
Joseph Davis 623a4db21f Enable unit tests for py36
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
2019-07-18 16:08:09 +02:00
Corey Bryant d457ccb052 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: I48bedc1b811f8e2ba49ce3b99dfa8d51a37e5354
Story: #2005924
Task: #34223
2019-07-05 13:02:28 -04:00
akhiljain23 3404a6df72 Update hacking version to 1.1.x
This commit updates hacking version in test-requirements
and fixes some related pep8 issues

Also ignores false positive bandit test
B105: hardcoded_password_string,
B106: hardcoded_password_funcarg
based on variable or argument names.
For more info refer [1][2]

[1] https://bandit.readthedocs.io/en/latest/plugins/b105_hardcoded_password_string.html
[2] https://bandit.readthedocs.io/en/latest/plugins/b106_hardcoded_password_funcarg.html

Change-Id: If779ebad11926594961577e0744093a8ba691610
Story: 2004930
Task: 29314
2019-06-26 12:49:13 +05:30
liuwei 723a710968 update git.openstack.org to opendev
Change-Id: I32edbe39cab80af6af947f3d3c81e31127ed3a24
2019-05-03 01:50:49 +00:00
Zuul 813d850605 Merge "Add python36 support" 2018-11-08 14:48:06 +00:00
Sean McGinnis cb74366bbc Remove setup.py check from pep8 job
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>
2018-10-30 10:23:28 -05:00
Chuck Short b8bb2ff4c3 Add python36 support
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>
2018-10-25 09:09:53 -04:00
Chuck Short 3add6ce9c6 Switch to using stestr
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>
2018-08-13 11:19:12 -04:00
Witold Bedyk 2f7153a59c Convert README to reStructuredText
* convert README
* add syntax check

Story: 2002163
Task: 24461

Change-Id: I09e089f2c74684fef7f12d79b238002893942d4d
2018-08-09 17:47:46 +02:00
Nguyen Hoai Nam 915b96f59c fix tox python3 overrides
It is necessary to move from python2.7 to python3 for cover test as the
previous commit: I12967d5f5e707efe2b271b28bc7ea4b40e7f1c15

Change-Id: I207c1962e05dae5e45353d58faeb8615170b1163
2018-07-22 23:28:49 +07:00
Adrian Czarnecki 96f08da015 fix tox python3 overrides
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
2018-07-02 09:41:20 +02:00
Jui Chandwaskar f837eee559 Update pep8 checks
* 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>
2018-04-12 11:05:01 +00:00
Andreas Jaeger 059e6037f1 Remove -U from pip install
'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
2017-12-02 19:27:03 +01:00
Andreas Jaeger 4a1b804e33 Avoid tox_install.sh for constraints support
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
2017-12-01 15:35:05 +01:00
Tomasz Trębski b71fd4bef4 Integrate with keystoneauth
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
2017-07-11 09:02:34 +02:00
Tomasz Trębski c9cb2da7a0 Define extra hacking rules to ensure code quality
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
2017-06-01 06:25:22 +02:00
Artur Basiak 3a4d5c5ce9 Enable cover for monasca_setup
Change-Id: Ia9c6aaa764aa65cdb889de2ced210e93d8363cc9
2017-05-31 05:07:55 +00:00
Koji Nakazono 43028beb13 FIX monasca_setup unit test
- Add monasca_setup to the target of flake8
- Add coverage for monasca_setup
- Fix code style of monasca_setup with flake8

Change-Id: I67ac65e95289e9cb5c8e3cb7655d416c69c2ec05
2017-05-31 09:15:16 +09:00
Tomasz Trębski 75dc1ae406 InfluxDB-Relay autodection
Added autodetection of influxdb-relay.
Plugin configures process and http_check
monitoring.

Change-Id: I386e87349283d35d2f4fda58f0e376ed59a6c5bf
2017-05-09 11:34:21 +02:00
Tomasz Trębski 0418111eaf Extend CI for monasca-agent
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
2017-03-30 06:33:59 +02:00
Lukasz Wiecek 2a8bf2926d Add proxy configuration for tox.ini file
Change-Id: Ib057b30c92bfff3ebe92bf787093d2fa5abcf80b
2017-01-31 12:32:42 +01:00
Dirk Mueller 10faaead9b Add Constraints support
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
2017-01-04 16:45:16 +01:00
Dirk Mueller b8dbb8dbdb Stop exluding flake8 tests that are passing
These can be enabled without any hits, so enable them since
the code is already conforming.

Change-Id: I3be74f70348a66d4be0f605997b4a88183777537
2016-12-07 13:10:36 +01:00
Artur Basiak e1860d0a74 Fixing problems with tox
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
2016-11-16 13:05:25 +00:00
donagh-mccabe 901b448b54 Make pep8 use py27
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
2016-11-04 11:04:06 +00:00
Andreas Jaeger e276c00efb Use constraints everywhere
Infra now supports constraints everywhere, remove now unused
workarounds.

For more information about constraints see:
http://lists.openstack.org/pipermail/openstack-dev/2016-August/101474.html

Change-Id: I672ddc61c0e34475492e80c2df9d1ee11af89277
2016-08-30 20:13:49 +02:00
Kaiyan Sheng 4d1ab9b338 Change tox.ini to not install requirements using global requirements
Also add constraints on each library in requirements.txt

Change-Id: If93862e438e5e724fb5fb94296ae7879411a5cd4
2016-07-15 13:15:26 -06:00
Andreas Jaeger 58662c0c00 List system dependencies for running common tests
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
2016-06-29 09:15:21 +02:00
Ryan Brandt f31702ba05 Ignore E402 and W503 pep errors
Fix an E731 error

Change-Id: Ic8e2ecc2109fb31b2619e03e5dfb07f08e9b5ff9
2016-06-16 15:52:44 -06:00
Kaiyan Sheng 53e77d8d3e [monasca-agent] Constraint tox targets with upper-constraints
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
2016-05-20 16:20:21 -06:00
Michael James Hoppal 8214984bd4 Change tox file
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
2016-04-20 17:02:18 -06:00
Kaiyan Sheng 4e1cc0d2cf Update Agent Requirements.txt
Change-Id: I7827b4811a9d5784e9c7e2e24ceb14c36a64029f
2016-01-21 16:00:07 -07:00
janonymous efbfb5fb0a py26 is no longer supported by Infra's CI
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
2015-12-26 14:02:06 +05:30
Haiwei Xu ba4a278c97 Delete python bytecode before every test run
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
2015-12-02 13:29:52 +09:00
Joe Keen ffd53d8536 Updating unit tests
Change-Id: I56a884962902a0633cd6dded0c1d877a116715b9
2015-08-20 15:04:00 -06:00
Joe Keen 1ded0b7b1c Fixing flake8 errors now that tox is working again
Change-Id: Id34991711c57f20922f003928008143032723af3
2015-07-30 14:47:02 -06:00
Michael James Hoppal a8929debda Modifications to accommodate for python 2.6
Change-Id: If959b8a9c7073cbbc97a9712945754116f026c5c
2015-02-06 11:18:09 -07:00
gary-hessler 45b156b9fe Cleaned up a lot of the Pep8 violations
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
2014-08-28 10:42:29 -06:00
Christian Berendt a17fb2143d Enable hacking check H234
* H234 assertEquals is deprecated, use assertEqual

Change-Id: I8faa8134b66db82bdd15a4634d40896fc42086a3
2014-08-05 21:00:21 +02:00
Christian Berendt 3d9fa1ed33 Enable hacking check H233
* H233  Python 3.x incompatible use of print operator

Change-Id: I7b4b0a68f4dbf9f53833a3264601bcd631bf006e
2014-08-05 18:22:44 +00:00
Christian Berendt ebfbd7f2d4 Add hacking as test requirement and use flake8 instead of pep8
Change-Id: Ia82e46d59c6dca0bb44e600dd8d512bbd3b98624
2014-07-24 11:44:37 +02:00