Commit Graph

52 Commits

Author SHA1 Message Date
Takashi Kajinami cc572226cd Fix python shebang
The current shebang requires /usr/bin/python which is not available in
Ubuntu Jammy by default.

Change-Id: Ice53cc822d9a103f28f991fc8b839097f822e2d1
2023-10-17 16:01:16 +00:00
Stephen Finucane 23e6493dee Remove trailing spaces, convert dos2unix
These are issues that pre-commit identified. Address them now.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I19f7d3689a000c41787b3fe15632564928bbf6a6
2023-06-01 12:11:43 +01:00
Maurice Escher 6a887f24d2
check_exec: /usr/bin/python3 bad interpreter
use /usr/bin/env python3

Closes-Bug: #2007975
Change-Id: I517e7245492ee68b25675628366998456173959a
2023-02-21 14:11:35 +01:00
songwenping fac7fc52eb Remove references to sys.version_info
We support Python 3.6 as a minimum now, making these checks no-ops.

Change-Id: I01cc9c8a6e3cf0244806dc739743ecd1dee3dc22
2021-05-28 15:40:54 +08:00
Ghanshyam Mann ffd3f1e760 [goal] Migrate tox based testing to ubuntu focal
As per victoria cycle testing runtime and community goal[1]
we need to migrate upstream CI/CD to Ubuntu Focal(20.04).

Fixing:
- bug#1886298
Bump the lower constraints for required deps which added python3.8 support
in their later version.

Story: #2007865
Task: #40194
Depends-On: https://review.opendev.org/#/c/738328/

Closes-Bug: #1886298

Change-Id: Ib0f84e8c3815be48bca0ae8d4fe15a56b5256c20
2020-09-09 13:19:39 -05:00
Sean McGinnis 23a8fe8633
Make test-setup.sh compatible with mysql8
Starting from mysql version 8 it's not possible to create a user
implictly when using GRANT.

This patch makes the behavior compatible with that.

Change-Id: Id92a73ffc98906f30cadee98650e86d4d080653b
Co-written-by: Riccardo Pittau <elfosardo@gmail.com>
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-06-30 08:12:41 -05:00
Goutham Pacha Ravi 7e6a76067a TrivialFix: Remove unnecessary future imports
print_function is available from python 3.0.0
with_statement has been available from python 2.6

Change-Id: Idb6dd5bb4f9d57cf544e8e55d173e3c85c9da455
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
2020-05-05 08:38:56 -07:00
Andreas Jaeger 8098045f2a Hacking: Fix E305
Fix:
E305 expected 2 blank lines after class or function definition, found 1

Fix also other problems found by hacking in these files.

Change-Id: I880afc40adf974cbb0e60f8dc5931f77d51f451b
2020-04-01 11:43:29 +02:00
Goutham Pacha Ravi 6f79bb6c89 Fix URLs in code and documentation
TrivialFix

Change-Id: I21863f7fdad2bdd5dee226a3f6872d25b1c4f8ad
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
2020-03-18 18:59:27 -07:00
Eric Harney 523c5aaa3a Pylint: use -j 0 arg
"-j 0" runs on the number of CPUs available, just
pass that instead of counting CPUs ourselves.

(This removes a stealthy python2 dependency, too.)

Change-Id: Ia058036ce8bd22be3b93a6fb71c66cb1b5e5f394
2019-09-11 10:56:45 -04:00
Goutham Pacha Ravi ec55c1a80e Validate API sample JSON files
We are maintaining these files by hand,
so errors are bound to creep in.

Change-Id: I1f5bbf8d5fcd396dfe63b9bf3ef95306c03765a4
2019-08-13 22:16:46 -07:00
Thomas Bechtold 551e92f216 Drop run_tests.sh and tools/colorizer.py
The CI is not using run_tests.sh so I assume people do not use it
either.
tools/colorizer.py is only used by run_tests.sh so remove this as
well.

Change-Id: I498943725f2635918141c1b02a5419e7eb90bd36
2019-03-20 12:09:01 +01:00
Goutham Pacha Ravi f2a0410ebd [pylint] Use filenames in coding-checks
When using the argument "all" in our pylint
script, we invoke tests against the whole tree.
This doesn't really work well with module names
since it ignores some submodules that are not
traversable from the main manila module.

By using filenames, we allow pylint to cover
all modules.

Change-Id: I37ea7f72e71ae93f8f654e0aa99744b2ecc1cea9
2019-03-05 22:08:53 +00:00
Goutham Pacha Ravi 10bd807423 [pylint] Run pylint separately for code and tests
We use the mock library in our
unit tests which assigns mocked objects with
members at run time. This causes pylint to flag
"no-member" errors. We also test return values
on methods which return None explicitly, or
implicitly, this upsets pylint.

pylint is quite inflexible in the way it handles
ignores in code. We can add ignore statements all
over the test code, but that is quite infeasible.

So, this change lets us run pylint separately
for code and test modules. When running tests,
it adjusts the disabled pylint checks.

Change-Id: I85d3fe896ee95c52c3da55aedba8f4d72d0c299e
2019-03-05 21:23:55 +00:00
Tom Barron 1838d51925 Fix spurious pylint import errors for ddt and mock
Set dependencies correctly for pylint job in tox.ini so
it does not report spurious E041 import errors on mock
and ddt modules.  Also fix a reference to Cinder instead
of Manila in the pylint script.

Closes-Bug: #1813156
Change-Id: Ib160caae57e41a4d45483ff4faa599143e694abc
2019-01-24 07:38:59 -05:00
Chuck Short 4d0abb4a14 Simplify running pylint
This commit does several things:

- Setup and run pylint directly rather than running through a script.
  This allows the user to see what is happening while the user is running
  through pylint.
- Allow the user to either run pylint on a particular changeset,
  or the entire manila tree.
- Allow the user to run on a particular changeset. Using like HEAD~1,
  etc.
- I disabled the tests that were reported by pylint.
  The thought here would be go through the failures
  and correct them.
- Update pylint to 2.1.1.

Change-Id: I398d1ba01a3fd7f1c86ad4065a7984d276f33383
Signed-off-by: Chuck Short <chucks@redhat.com>
2018-10-11 15:13:49 -04:00
Tom Barron 772a64a871 Remove run_tests.sh
It is deprecated in favor of tox.

Closes-Bug: #1790470
Change-Id: If3b6a274dab0d035b9666b3b9876604cefbc2877
2018-10-04 09:55:45 -04:00
Sean McGinnis 4c943fbcb2 Default pylint to run using python3
Updates the pylint and lint jobs to run under python3 by
changing the target python and updating the version of
pylint used.

Change-Id: Ie0ac158674fb22054b80864d33d9d7ecc82e3b36
Closes-bug: #1673824
2018-06-06 16:14:22 -05:00
lijunbo e8bca58887 Use stestr for coverage
Change [1] restored .testr.conf since it was needed for the manila
coverage job.

Modify script used by the coverage job to invoke stestr rather than
setup.py with testr so that this job no longer requires .testr.conf
so remove the dotfile and update .gitignore.
TrivialFix

[1] I451e383ed654d00a5a017cb28521c47566911f33

Change-Id: Ibf549220303395744380f79993fbfcf04b2ed5b7
Co-Authored-By: Tom Barron <tpb@dyncloud.net>
2018-01-14 13:26:53 +08:00
yanghuichan 1985790eb1 Fix grammatical mistake, Changed character from "a" to "an"
Change-Id: Idbf80945316a15c3fc2993a78bd6d4e2f5ec03fe
2017-07-14 13:39:26 +08:00
Andreas Jaeger 31494d4af1 Prepare for using standard python tests
Add simple script to setup mysql and postgresql databases, this script
can be run by users during testing and will be run by CI systems for
specific setup before running unit tests. This is exactly what is
currently done by OpenStack CI in project-config.

This allows to change in project-config the python-db jobs to
python-jobs since python-jobs will call this script initially.

See also
http://lists.openstack.org/pipermail/openstack-dev/2016-November/107784.html

Needed-By: I7a46bbabc1da1c4cf993730bb62b54a638ffbac8
Change-Id: Ia066b7b25f6efeadf87bac0d62f66a9ee4ed1f24
2017-02-03 21:37:33 +01:00
gengchc2 40e073a8a1 use six.StringIO for compatibility with io.StringIO in python3
The newer version of six (1.4.1) provides six.StringIO
which is a fake file object for textual data. It's an
alias for cStringIO.StringIO, in python2 and io.StringIO
in Python3

Change-Id: I5f4af05eb0754d85a73068d5f6b285d4be07cdfc
2016-12-20 11:43:19 +08:00
zhangyanxian f2f66c8ada Fix spelling mistakes in cover.sh
TrivalFix

Change-Id: Iedc1fc108d090e11d8d942379aa8c32d212d16e1
2016-11-16 11:42:40 +00:00
Tom Barron 1c2ec9b8cf Detect addition of executable files
When running pep8 checks, fail if executable
files have accidentally been added.

Co-Authored-By: Eric Harney <eharney@redhat.com>

Closes-Bug: 1566328
Change-Id: I7280c0403cd473cd4b88cfc021d4f605a7bb35f2
2016-04-08 14:28:42 +00:00
Tom Barron 72ab1442ad Remove unused logging import and LOG global
This patch removes unused global LOG variable
and logging imports from various manila modules,
and adds a script to be run as part of pep8 that
will ensure that these do not creep back into
the codebase.

Change-Id: I162c4b2478df45aaf6ea8009b102d6de1a4e309e
2016-04-05 07:06:08 -04:00
Tom Barron 334e08121c Add tox fast8 option
This commit ports over the fast8 option from cinder, which enables
one to run pep8 only on one's changeset rather than against the
whole body of code via:
     tox -efast8

Change-Id: Icb0286c3c66983f2f106c163cb11c690b2c57849
2016-02-21 09:19:39 -05:00
David Sariel 4a61faa065 Removed ignored checks from tox.ini and fixed pep8 issues
Due to the hacking version update several pep8 checks where ignored
in the flakes8 section of the tox.ini. Removed ignored checks and fixed
appropriate pep8 issues.

The list of fixed issues:
    - H105 Don't use author tags
    - H238 Old style class declaration, use new style (inherit from `object`)
    - H501 Do not use self.__dict__ for string formatting

Closes-Bug: 1530719
Change-Id: I890ba4c54b0da10060767620ff5ff7e480d79a9c
2016-02-14 14:56:55 +02:00
Clinton Knight 1070ba728e Last sync to Manila from oslo-incubator
Oslo incubator is going away, and we cannot use the sync script
to copy the incubator files to Manila one last time because at
least one file has changed in Manila since the last sync.  This
commit includes the remaining changes which we do want.  The files
are consistent with the oslo-incubator master branch as of commit
305c2b0d52d387c0039e3b3021c4de27e85cd175.

Change-Id: Ib880a0108e4a567ebe39aa1ada7f872c63a818f1
2015-11-20 19:20:21 +00:00
Valeriy Ponomaryov 4778740261 Fix 'cover' tox job
Our 'cover' tox job does not work with release of 'coverage' package v4.0
It fails on option 'ignore-errors' in config section '[report]'.

So, replace usage of this option with CLI option '--ignore-errors'.

Change-Id: I404e3cb63453b0245ac05b4d3cb5780e5b8b7f9a
Closes-Bug: #1497897
2015-09-21 15:09:22 +03:00
Valeriy Ponomaryov 4ea9031b4f Make coverage tox job fail when test coverage was reduced
For the moment we can just calculate coverage and generate html with results.
It would be really useful to be able to get 'failure' by this job, when
latest commit introduced reduction of test coverage by any reason - either
addon of new code not covered with unit tests or deletion of existing unit
tests.
It will reduce total required efforts for code reviewers, that are forced now
to perform such check separately and inform about it committer.

Added file 'tools/cover.sh' is taken from OpenStack Rally project as
of state [1], with couple of fixes for satisfying 'bashate'.

Also add configuration file for coverage package.

[1] I7b4defe187c0631928d70bd09d7bcea956f4eed3

Change-Id: Ie0c5721985ae48256d9bb26af5fdb4b05797b359
2015-07-27 14:53:37 +03:00
Luis Pabón 72d2840048 Enable developers to see pylint output
The program tools/lintstack.py which is executed by
tools/lintstack.sh when Jenkins runs, only tests for differences
in the output of pylint. Right now, there seems to be
17 errors/warnings that are being carried over from fix to fix,
with no difference between fixes, and so no failures in the
pylint Jenkins job.

It is really difficult to tell what the errors are, so this fix
allows developers determine what the errors are by running the
following command:

$ tox -e lint

A sample output of the command is available as an attachment
to the bug.

Change-Id: I88487829576d55d437b934e08571013b7a6e57cf
Signed-off-by: Luis Pabón <lpabon@redhat.com>
Closes-Bug: #1356588
Signed-off-by: Luis Pabón <lpabon@redhat.com>
2015-04-03 15:10:18 -04:00
chen-li a6a76d6821 py3: use six.moves.urllib.parse instead of urlparse
six is the canonical compatibility library for supporting
Python 2 and 3 in a single codebase.

The urlparse module  was removed in Python 3 and we should
use 'six.moves.urllib.parse' instead of 'urlparse' to make
code compatible with py 2 and 3 as well.

Partially-implements blueprint py3-compatibility

Change-Id: Ib27244d0583e81e307d5e4236cbf85d29566dde9
2014-12-27 08:51:32 +08:00
Andreas Jaeger 0c93feeb5b Sync with oslo-incubator
Remove obsoleted modules from tree.
Sync with oslo-incubator at commit
838a2a31fe009feb2501716d6656eeea426ea357.

The updated lockfile module needs setting of the lock_path option,
ensure that it is set in the testsuite.

Closes-Bug: #1382189
Change-Id: I43ca76a21bd5bdb45f23af9b99b96aefa635ccc1
2014-10-26 08:12:04 +00:00
Andreas Jaeger 883e02f219 Switch to oslo.config
The config module in oslo-incubator has been replaced by oslo.config.
Projects need to switch completely to oslo.config for kilo.

This patch does:
* Register options with oslo.config (new file manila/opts.py)
* Generate the config file using oslo-config-generator
* Remove obsoleted entries for this from openstack-common.conf
* Remove oslo-incubator config files

Change-Id: I30b594423c08782e13a1f615099ae65f997a8551
Closes-Bug: #1382183
2014-10-22 19:55:45 +02:00
Marc Koderer ecf603bc05 Remove vim headers
As discussed in [1] remove all vim headers from manila files.

[1]: http://lists.openstack.org/pipermail/openstack-dev/2013-October/017353.html

Change-Id: I341486c66ffe4dad7db8608fdc66868ceb7ad95a
Closes-Bug: #1229324
2014-10-06 15:00:27 +02:00
Andreas Jaeger 8203c51081 Flake8: Fix and enable H404
Fix and enable flake8 test H404:
H404  multi line docstring should start without a leading new line

Change-Id: I13dc13bb5e81d65300680df094cde538c7a6f6df
Partial-Bug: #1333290
2014-08-27 10:47:45 +00:00
Andreas Jaeger 89fa0160a6 Sync scripts with oslo-incubator
Sync all scripts with oslo-incubator (commit fed72f3).

Add scripts also to openstack-common.conf.

Change-Id: I4e595560e002f65d3a6d8e867c17eba04f0a8889
2014-08-14 12:09:46 +02:00
Thomas Bechtold c16feaea5e Use common config generator
Delete Manila's implementation located in tools/conf and replace
it with common config generator located in tools/config. The new config
generator include config options from other modules (olso.messaging,
oslo.db, oslo.db.concurrency) which improves the generated sample config.

Change-Id: I553e1a8ec414383e2d79d445ebd10e0e1ffa1ae4
2014-08-12 16:33:06 +02:00
Thomas Bechtold 347fccd92f Add config module from oslo-incubator
Generated with: `./update.sh --module config --base manila
../../stackforge/manila/` from oslo-incubator, commit fed72f32.
This common code is expected to be used instead of Manila's
implementation located in 'tools/conf'.

Change-Id: I147888ba98ccb2ec98b9ced87b06d8f4766ec361
2014-08-12 15:12:17 +02:00
Valeriy Ponomaryov 8abe92efa9 py3: use six.string_types instead of basestring
six is the canonical compatibility library for supporting Python 2 and 3
in a single codebase.

The basestring was removed in Python 3 and we should use 'six.string_types'
instead of 'basestring' to make code compatible with py 2 and 3 as well.

Partially-implements blueprint py3-compatibility

Change-Id: Idb452afdc2a828089627e14f90c53f3967ceb2ad
2014-07-25 06:02:44 +00:00
vponomaryov 16a04df3d0 Refactor test framework
Manila's test framework is pretty old and requires update.

Changes:
- usage of nose replaced with testr
- now all the tests are thread safe
- added new options for run_tests.sh, such as --concurrency, --debug, etc...
- new '--concurrency' option for run_tests.sh defaults to 1, examples:
    ./run_tests.sh  # will run in 1 thread
    ./run_tests.sh --concurrency 2  # will run tests in 2 threads
- added tools/colorizer.py for colorizing output of testrun with run_tests.sh
- tests running with tox use as much threads as cores available by default
- examples of testrun with tox:
    tox  # will run test suites defined with 'envlist' in tox.ini, now it is pep8,py26,py27
    tox -epy27  # amount of threads is equal to amount of cores
    tox -epy27 -- --concurrency=2  # amount of threads is 2
    tox -epy27 -- --concurrency=4  # amount of threads is 4
- Added 'Database' class to manila.test module, for more conveniant db testing
- updated policy file 'manila/tests/policy.json' to allow share-network actions
- removed nose-related requirements
- added new requirements for testrepository, subunit

With merge of this change all old installed virtual environments become
incompatible and should be removed with "rm -rf .tox .venv" before testrun.

Implements blueprint testr-with-unittests

Change-Id: I9579ecd538e29d478dbc12adc7dcc33fc668b397
2014-07-22 14:58:48 +03:00
Valeriy Ponomaryov 4c9a4808b7 Replace python print operator with print function (pep H233, py33)
'print' function is compatible with 2.x and 3.x python versions

Partially-implements blueprint py3-compatibility

Change-Id: Idea6704be7f49778ca9e99be5b7f449cb89f39dc
2014-07-02 08:56:12 -04:00
vponomaryov 07e47e1593 Fix venv installation for run_tests.sh
Change-Id: I24810421f82da3d9d0ba6600b98955f28569a6a8
Closes-bug: 1261518
2014-03-25 12:21:29 +02:00
Mark McLoughlin ae0263e849 Remove obsolete redhat-eventlet.patch
See I62ce43a330d7ae94eda4c7498782a655e63747fa for the gorey details on
why this exists.

As of this fix:

  https://github.com/eventlet/eventlet/pull/34

which was released in eventlet 0.13, we no longer need the patch.

This has now been removed from oslo-incubator, so this is really just
syncing that removal.

Change-Id: I84267f3c6726cb2e750f615e107c48b12c6ed353
2013-10-17 07:11:52 +01:00
Monty Taylor bbd21eb4cc Remove d2to1 dependency
Change-Id: I9e91070e61e00cbc7d99ff223e85c3c371f60566
2013-09-30 10:48:26 -04:00
ubu 9a68e91f9e modified conf sample 2013-09-17 05:24:40 -04:00
Yulia Portnova 9169fc311e docs 2013-09-17 10:57:47 +03:00
Yulia Portnova 4f5dde7db5 Fixed flake8 errors 2013-09-11 12:34:25 +03:00
ubu 59411bf710 Update connfig.sample scripts 2013-09-05 15:25:47 +03:00
Yulia Portnova 4e2f27c11a Replaced cinder with manila 2013-09-04 15:45:32 +03:00