Commit Graph

67 Commits

Author SHA1 Message Date
yangzhe 0c4226cae9 Use py3 as the default runtime for tox
Moving on py3 as the default runtime for tox to avoid to update
this at each new cycle.

Change-Id: I4f1d0445e858dc91a949ad596df62e173d210935
2023-08-08 16:25:53 +08:00
tomas 9012520344 cyborg Fix tox4 error
Other failure is due to the skipsdist = True.

Fixing tox.ini for tox4 changes.

Change-Id: I70e5b8569efb0f898a444de4ed043ed3b7b77f78
2022-12-31 07:38:04 +00:00
niuke 2bfa6634ad Use py3 as the default runtime for tox
Moving on py3 as the default runtime for tox to avoid to update
this at each new cycle.

Change-Id: If49d95aee3009155431f03409e169193ffa00835
2022-09-16 13:11:22 +08:00
Ghanshyam Mann 6699919069 Updating python testing classifier as per Yoga testing runtime
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: I7006d6484aca8dfc3c96812d564f1a385f339f0d
2021-12-14 02:40:41 +00:00
Zuul 32d69adf63 Merge "Erase previously collected coverage for cybrog" 2021-08-31 01:25:37 +00:00
songwenping b30baf0ff2 Changed minversion in tox to 3.18.0
The patch bumps min version of tox to 3.18.0 in order to
replace tox's whitelist_externals by allowlist_externals option:
https://github.com/tox-dev/tox/blob/master/docs/changelog.rst#v3180-2020-07-23

Change-Id: I3b687738c170dea60fca7fb2fe74fa5bbc37ab02
2021-08-13 10:19:28 +08:00
wangyue_cmss 20547d4fc1 Erase previously collected coverage for cybrog
In "tox -e cover" command, erase previously collected coverage data first.

Change-Id: Ie630b3c96857589dd8a5ff1009735d1d6aab41c7
Signed-off-by: wangyue_cmss <wangyue_yewu@cmss.chinamobile.com>
2021-07-01 17:07:38 +08:00
Zuul 777f45742c Merge "Change the dependency with the testenv:docs" 2020-12-31 03:04:38 +00:00
Arhtur Dayne cacf91418f 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: Ia9bee740acbe81eb9b7adf3b3df15e20e955ca12
2020-12-25 16:15:32 +08:00
zhangbailin 396559309b Change the dependency with the testenv:docs
Add the description for pep8, docs, pdf-docs, releasenotes, api-ref.
Change the pdf-docs and releasenotes's packages dependency with the
test docs requirement.

Story: 2008360

Change-Id: Ifcb28a340733b90329970be0078118d523b64bd3
2020-12-17 08:47:13 +00:00
wu.shiming 54b4fa53ad Dep's should be restricted by upper-constraints
Tox trying to install latest versions for building docs which may
not be supported by stable and lower branches, so should be
restricted by respective version's upper-constraints.txt

Change-Id: Ic2d0f0a49ff279fe7322a9c6b3a179b5e8e04708
2020-12-07 01:05:59 +00:00
Zuul 9fa4e71c1f Merge "improve pep8 check logic" 2020-11-19 10:57:07 +00:00
Zuul 02180ece20 Merge "Add fast8 check for cybrog" 2020-10-24 04:13:32 +00:00
songwenping f7bc91e136 Bump py37 to py38 in tox.ini
Python 3.8 is now our highest level supported python runtime.
This updates the default tox target environments to swap out py37 for
py38 to make sure local development testing is covering this version.
This does not impact zuul jobs in any way, nor prevent local tests
against py37. It just changes the default if none is explicitly provided.

refer: https://governance.openstack.org/tc/reference/runtimes/victoria.html

Change-Id: I381f8ab89246e37af988ab7bf616914e5de7d20b
2020-10-12 03:31:04 +00:00
zhangbailin bb4fd104a3 improve pep8 check logic
Introduce the json file check, cherry-pick patches check, and use flake8
shell instead of flake8 command.

Change-Id: I94e1554028535a361cb9f9e6e73c15702e459e4f
2020-10-09 05:55:58 +00:00
zhangbailin c61e8ef3fc Add fast8 check for cybrog
Add "tox -e fast8" command, that we can check the changes file whether
is ok of it's PEP8 format.

Change-Id: I370bc8449321932831df4fe783be5c9ff0ed65df
2020-09-29 10:45:40 +08:00
zhangbailin 59fc114d30 hacking: force explicit import of python's mock
Since we dropped support for python 2 [1], we no longer need to use the
mock library, which existed to backport py3 functionality into py2.
Which must be done by saying::

    from unittest import mock

...because if you say::

    import mock

...you definitely will not be getting the standard library mock.
That will always import the third party mock library.

This commit adds hacking check N366 to enforce the former.

This check can be removed in the future (and we can start saying
``import mock`` again) if we manage to purge these transitive
dependencies. I'm not holding my breath.

[1]https://review.opendev.org/#/c/688593/

Change-Id: I79b0a084b8a99c54ce175a520e039e5572c5165a
2020-06-19 09:33:13 +00:00
zhangbailin d4441daf9c Upgrade minversion to match python3
ignore_basepython_conflict flag is introduced in that version so we need
to raise it if using that flag.

Change-Id: Ie40535ebe42504aceb7c15efbce52038ce3f9b3b
2020-04-02 08:11:02 +08:00
Andreas Jaeger a6f84335bb Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found:
E117 over-indented
E501 line too long
E741 ambiguous variable name 'l'
W605 invalid escape sequence

Blacklist:
W503 line break before binary operator
W504 line break after binary operator

Update local hacking checks for new flake8.

Change-Id: I5d11a1f87d9547d9b6a27bf1f79cd69e0f73c741
2020-03-30 16:18:12 +02:00
Arthur Dayne 31d23b7315 Generate PDF documentation
- Add a new pdf-docs environment to enable PDF build.
- sphinxcontrib-svg2pdfconverter is used to handle SVG properly.
- maxlistdepth=10 in latex_elements is needed to handle
  deeper levels of nesting.
- Specify openany in extraclassoptions to skip blank pages
  (oneside is also specified to use the same page layout
   for even and odd pages)
- tocdepth is set to 2 for better PDF TOC
- printindex and makeindex are set to empty in latex_elements
  to avoid an empty "Index" section in PDF
- Sample config/policy files are skipped in the PDF document
  as inline sample files cause LaTeX error [1] and direct links
  in PDF doc is discouraged. Note that sample-config and sample-policy
  need to be excluded to avoid the LaTeX error [1] and
  :orphan: is specified in those files.

[1] https://github.com/sphinx-doc/sphinx/issues/3099

Change-Id: I70100a71114e1d75833e6c783086325baa0e3fd2
2020-03-21 15:02:55 +00:00
chenke 08af601271 Solve py37 timeout
Py37 job always reports timeout error recently.
Please see [1] [2] [3].
At first it was suspected that the error was reported
because of the patch [4].
Therefore, Feng Shaohe's patch [5] revoked the merge,
and at this time, disappeared at py37 timeout.

But in fact, this problem is just hidden.
After removing this setting, the job of py37
is actually running on the environment of python 3.6
(community CI default version is 3.6), please see [6]
for detailed reasons.

Therefore, this patch exposes the hidden py37 timeout problem,
and at the same time, found method test_apply_patch_fpga_arq_monitor_job
, think it is the reason of the timeout. The reason I can find
this method is based on the the troubleshooting of tox -epy37 log.
After commenting out this method, I found that tox -epy37 can run
normally and there is no longer a timeout problem.

If you want to test, please ensure that you have a local
python3.7 environment, not 3.6, and execute rm .tox / -rf.
Then execute tox -epy37.

Therefore, the best way is to comment out this method and
restore py37 job at the same time.

If a friend discovers further reasons and solution, this method
can be restored, please refer to [7].

What went wrong in this method?
It is because in the deep call of this method, ThreadWork of
the thread pool will be used, which under Python3.7 will block
the execution of unit tests. For specific reasons, please see
[8] [9].

Reference:

[1]. https://review.opendev.org/#/c/702578/
[2]. https://review.opendev.org/#/c/703049/
[3]. https://review.opendev.org/#/c/703253/
[4]. https://review.opendev.org/#/c/696397/
[5]. https://review.opendev.org/#/c/706911/
[6]. http://eavesdrop.openstack.org/irclogs/%23openstack-infra/%23openstack-infra.2020-02-12.log.html#t2020-02-12T16:46:18
[7]. deed9c822e
[8]. https://review.opendev.org/#/c/707045/5//COMMIT_MSG
[9]. c61dd8c376/cyborg/objects/extarq/ext_arq_job.py (L41)

Change-Id: I09db889fe665c6246ec9503af92c909e7d0da24f
2020-02-14 19:49:34 +08:00
Shaohe Feng 5b6f26abb8 Guess for the root cause of timeout
Change-Id: I877794c738f3c6ec09e9f83476b1f91096447afa
2020-02-10 23:36:10 -08:00
Zuul a39f816b55 Merge "Set ignore_basepython_conflict (fixes confusing pep8 message)" 2020-01-16 00:59:35 +00:00
Yumeng Bao d765a344ee Introduce bandit security linter
Cyborg now does not have a code security check, which may connive at
possible security issues. For example, shell-related operations for drivers
may be insecure. Current "sudo lspci -nnn -D" in huawei ascend driver code[0]
is insecure, but there is no any job/test that can check the potential security
issues. So this patch introduces bandit as a code security check.

[0]:https://github.com/openstack/cyborg/blob/master/cyborg/accelerator/drivers/aichip/huawei/ascend.py#L69

Change-Id: Ia1f9acbbd176180cb5fe97b1a2eee5f98a95dea6
2020-01-05 19:49:22 -08:00
Eric Fried d496229f13 Set ignore_basepython_conflict (fixes confusing pep8 message)
Automatic envs (pyXX) will only use the python version appropriate to
that env and ignore basepython inherited from [testenv] if we set
ignore_basepython_conflict.

The lack thereof was causing pep8 jobs in the gate to output lines like:

   pep8: skipped tests
   congratulations :)
 /usr/local/lib/python3.6/dist-packages/tox/config/__init__.py:582: UserWarning: conflicting basepython version (set 3.6, should be 3.7) for env 'py37';resolve conflict or set ignore_basepython_conflict
   proposed_version, implied_version, testenv_config.envname

...despite the fact that the job was actually running.

Change-Id: Icb5281756d77117fb28139b9cc720b055e481290
2019-11-27 15:16:12 -06:00
Arthur Dayne 6b9ab023e1 Stop testing python2.7
Python 2.7 support has been dropped. Last release of Cyborg to support
py2.7 is OpenStack Train. The minimum version of Python now
supported by Cyborg is Python 3.6.

Depends-On: https://review.opendev.org/#/c/691766/
Change-Id: Ie87ef7727b50d8d5ca43f0283c5688199c35412e
2019-11-19 02:09:08 -05:00
chenke 9dcbbb33bc Enable openstack-cover-jobs in zuul check for cyborg
In this U version, Improve UT for important Cyborg module is
an important task.

It is necessary to add openstack-cover-jobs to zuul. This way
we can easily view the unit test coverage of each file.

such as nova:
https://github.com/openstack/nova/blob/master/.zuul.yaml#L374

Change-Id: I854a51a2105628c5e5e9c30282e0f4b259c33ed3
2019-10-24 20:39:54 +08:00
chenke 306b82e214 P8: Fix pep8 error in cyborg/tests and add post_mortem_debug.py
1. Add post_mortem_debug.py because accelerator/drivers/gpu/test_base.py
lack this file[1]. Reference Neutron[2,3].

[1]. https://github.com/openstack/cyborg/blob/master/cyborg/tests/base.py#L104
[2]. 43352e67e5/neutron/tests/base.py (L229)
[3]. https://github.com/openstack/neutron/blob/master/neutron/tests/post_mortem_debug.py

2. Remove old useless file cyborg/tests/unit/fake_accelerator.py[4,5].

[4]. https://github.com/openstack/cyborg/search?q=fake_accelerator_obj&unscoped_q=fake_accelerator_obj
[5]. https://review.opendev.org/#/c/625630/

Change-Id: I147bfe9a8dfb6bdbe7e59fa3dc0c146c70e4d3a7
2019-09-18 16:24:05 +08:00
chenke ac4c4ea15c P7: Fix pep8 error in cyborg/objects and cyborg/image
Change-Id: If62755aad795319fec9d016d950c9c6d26881522
2019-09-18 16:20:59 +08:00
chenke 369abe8dd0 P6: Fix pep8 error in cyborg/agent and cyborg/db
Change-Id: I3b30cc6388ceb9f771c09007c696d8ea69608860
2019-09-18 15:07:02 +08:00
chenke de4efde491 P5: Fix pep8 error in cyborg/accelerator
Change-Id: I8d54d98e9b116067397a49e9ebb40af5fdc715ba
2019-09-18 15:06:29 +08:00
Zuul 0f87dca124 Merge "P4: Fix pep8 error in cyborg/api" 2019-09-04 07:58:00 +00:00
Zuul d9e51efbbd Merge "P3: Fix pep8 error in cyborg/common and cyborg/conductor" 2019-09-04 07:50:33 +00:00
Zuul 34fc4eb660 Merge "P2: Fix pep8 error in cyborg/conf and cyborg/cmd" 2019-09-04 07:50:30 +00:00
Zuul cda15a3f2e Merge "Fix pep8 error in cyborg/*.py and add Forbidden class" 2019-09-03 05:59:26 +00:00
Zuul af7e412a81 Merge "Move to releases.openstack.org" 2019-08-29 21:13:59 +00:00
chenke e8a3803615 P4: Fix pep8 error in cyborg/api
Change-Id: I46699623b99add526aff2121e60ad7e88c107da1
2019-08-29 15:21:09 +08:00
chenke 1e7561a0f3 P3: Fix pep8 error in cyborg/common and cyborg/conductor
Change-Id: I9cf569b797596fa60fc0c6715b4fbe1c5ce0f007
2019-08-29 15:17:41 +08:00
chenke 03b7331a34 P2: Fix pep8 error in cyborg/conf and cyborg/cmd
Change-Id: Ie3c09f712ef8ae488928eb251a7fdfed5a8392ac
2019-08-29 15:17:14 +08:00
chenke cc19e2d662 Fix pep8 error in cyborg/*.py and add Forbidden class
This patch will first fix pep8 error in cyborg/*.py, but except
the sub dir, like cyborg/api*、cyborg/cmd/*...., these code will
be fixed in the follow patch.

This patch does two things:

1. Add Forbidden class in cyborg/common/excpetion.py and modify
NotAuthorized class、HTTPForbidden class.

For the cyborg/context.py, There is no exception called Forbidden
in the cyborg library. I guess this part of the code is referenced
to nova[1]. However, in the nova library [2], they define a Forbidden
class, so we can also defined class Forbidden in cyborg/common/exception.py,
and import it in the format of pep8.

At the same time, the content defined by NotAuthorized and
HTTPForbidden is inconsistent with the effect it wants to
achieve, so NotAuthorized and HTTPForbidden are modified here.

2. Adjust the import order in cyborg/quota.py.

[1]. https://github.com/openstack/nova/blob/master/nova/context.py#L300
[2]. https://github.com/openstack/nova/blob/master/nova/exception.py#L162

Change-Id: Ia7b22272412b5e5fe6a5fa0cdf06fff7870bc07d
2019-08-29 15:16:42 +08:00
Yikun Jiang 7a4c80e7e2 Add bindep support
Add an bindep.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.

Cyborg requires package 'pciutils' because it is required for running
'lspci' command, this patch also add it.

[*] http://docs.openstack.org/infra/bindep/

Change-Id: If8eca0bcc187aed9fb2ef6794171a1acbc202079
2019-08-05 14:31:35 +08:00
Andreas Jaeger 16c6c378a9 Update api-ref location
The api documentation is now published on docs.openstack.org instead
of developer.openstack.org. Update all links that are changed to the
new location.

Note that redirects will be set up as well but let's point now to the
new location.

For details, see:
http://lists.openstack.org/pipermail/openstack-discuss/2019-July/007828.html

Change-Id: Id0b8c3aed2cf11a4adfcfedf1e99ac070804b58f
2019-07-22 18:16:43 +02:00
tonybrad 9c1a1f9824 Move to releases.openstack.org
Change-Id: I42670ff4be1d2580c73a1d0fbff8069281dad240
2019-06-12 11:30:59 +08:00
zhangbailin 256d9d4b3c Dropping the py35 testing
All the integration testing has been moved to
Bionic now[1] and py3.5 is not tested runtime for
Train or stable/stein[2].

As per below ML thread, we are good to drop the py35
testing now:
http://lists.openstack.org/pipermail/openstack-discuss/2019-April/005097.html

[1] http://lists.openstack.org/pipermail/openstack-discuss/2019-April/004647.html
[2]
https://governance.openstack.org/tc/reference/runtimes/stein.html
https://governance.openstack.org/tc/reference/runtimes/train.html

Change-Id: Ib19f54bc790190f9d26164126a528acf78b92f6f
2019-05-18 15:36:18 +08:00
Le Hou e908282622 Use opendev repository
Change-Id: Ibf9a0776d06b1b9fdccc8701a8b0df708800fb9e
2019-04-23 17:23:37 +08:00
Yumeng Bao 947d828cdf Initial commit for cyborg api-ref
This is the first commit for add cyborg api-ref.

Change-Id: Ida207606c3da704548f0ac032b203cad804b314f
2019-03-21 19:52:42 -07:00
Zhao Yi 6fc9220797 Fix tox -e py27
added deps in tox.ini

Change-Id: I223bae37333ae37fa4b84a6804028ac777e8ec9e
Story: #2004699
Task: #28718
2019-01-11 04:53:13 -05:00
melissaml c9398c255c Don't quote {posargs} in tox.ini
Quotes around {posargs} cause the entire string to be combined into one
arg that gets passed to stestr. This prevents passing multiple args
(e.g. '--concurrency=16 some-regex')

Change-Id: I1e860339c2fad9e86c0a2cacf344a6ff94325873
2018-10-21 22:43:55 +08:00
Nguyen Quang Huy 0138345cc3 Improve pep8 checking along with hacking
This change will help to check pep8. And the gates
will check this missing in the next time.

Change-Id: I62a29a8880e4d2cc1d410ef69991249b85ab7f6e
2018-08-16 17:22:33 +07:00
Yumeng Bao 33b86b8631 Follow the new PTI for document build
In order to follow the new PTI for doc build, this patch:
1)removes unused build_sphinx in setup.cfg
2)move doc dependencies from test-requirements.txt to doc/requirements.txt
3)update tox.ini

For compliance with the Project Testing Interface as described in:
https://governance.openstack.org/tc/reference/project-testing-interface.html

For more details information, please refer to:
http://lists.openstack.org/pipermail/openstack-dev/2017-December/125710.html

Change-Id: Ic700f04b857516ce5b25ce5e0fc431d1f08e24f3
2018-08-11 12:55:49 +08:00