Commit Graph

8 Commits

Author SHA1 Message Date
Zhao Chao 8ce9d735d2 Fix guestagent.test_operating_system for Python3
* Tests for _write_file_as_root failed because tempfile.NamedTemporaryFile
  use binary mode by default, changing to text mode fixes.
* Migrate to olso_serialization.base64 for Base64Codec. Also change the
  return value from bytearray to bytes for Base64Codec.deserialize.
  Base64Codec supports reverse encoding(i.e. binary data will be written
  to the dest file), in this situation, the dest file should be opened
  with binary mode(and when reading from the file, binary mode should
  also be used).
* stream_codecs.StringConverter converts iterable objects with map
  function. The behavior of map function is different under Python 2.x
  and 3.x. However csv.writerows(before Python 3.5) and unpack_singleton in
  trove.common.utils both need a list object. Converting the return
  value of map function to a list explicitly before passing to these
  functions fixes.

guestagent.test_operating_system is the last blacklist regex pattern for
py3 unittests. With the above problems fixed, blacklist-py3.txt is not
needed any more, and tox.ini is also updateted.

Migrating from ostestr to stestr is also done while updating tox.ini.
Here is the ML post for more information about os-testr and stestr:

http://lists.openstack.org/pipermail/openstack-dev/2017-September/122135.html

Partially implements: blueprint trove-python3

Change-Id: I31f1f97901d6ebff8a91c1b70a343e724ab806eb
Signed-off-by: Zhao Chao <zhaochao1984@gmail.com>
2018-03-01 10:52:26 +08:00
jiansong ba91e98068 Remove blacklist test volume
Now,We have error in test volume in py3,I have modified the error.
replace NamedTemporaryFile(delete=False) -> NamedTemporaryFile
(mode='w', delete=False).That will open the temporary file in
the text mode.

Closes-Bug #1633789
Change-Id: I24f2fbd13eaacaa0efe5601490cdc08edcd4b1d2
2016-10-26 05:27:09 +00:00
Petr Malik 4b6285f702 Port pagination on Python 3
Use an empty string rather None as marker for bisect.
On Python 3, a comparison between None and strings now raises a TypeError.

Partially implements: blueprint trove-python3

Change-Id: Iaefc20bd1cc980732e0c8a075e570958335c17e1
2016-08-31 18:12:49 -04:00
Victor Stinner 6a185da460 py3: Enable test_backup_models and test_datastores
It looks like these two unit tests pass on Python 3: remove them from
blacklist-py3.txt.

Partially implements: blueprint trove-python3
Change-Id: I230055c1aa0786290f9cae44f81861d91850d87b
2016-07-21 11:57:00 +02:00
Victor Stinner 207991af39 Port guestagent test_dbaas to Python 3
* Use encodeutils.exception_to_unicode() to get the message of
  exceptions. On Python 3, the message attribute of exceptions has
  been removed.
* NamedTemporaryFile: open files in text mode, not in binary mode.
* test_dbaas: set rowcount in execute() mocks to avoid comparison
  with a mock which now raises a TypeError on Python 3.
* replace "rowcount <= limit" with
  "limit is not None and rowcount <= limit" to avoid comparison
  between int and None (TypeError on Python 3)
* Replace urllib.quote() with six.moves.urllib.parse.quote
* blacklist-py3.txt: remove guestagent.test_dbaas to run it
  on Python 3

Partially implements: blueprint trove-python3
Change-Id: Ibdd34485ce4f2fb3572dcd7f57cbf9e5b6f42a13
2016-07-21 11:46:19 +02:00
Victor Stinner e60db53db7 Port galera and redis cluster tests to Python 3
* Replace map() with list-comprehension or regular loop to get the
  same behaviour on Python 2 and Python 3.
* Remove test_galera_cluster and test_redis_cluster from
  blacklist-py3.txt to run them on Python 3

Partially implements: blueprint trove-python3
Change-Id: Id373a0431b98ea7687dc82a48e82f16fedaac5a0
2016-06-29 15:55:18 +02:00
Victor Stinner 3bd6496998 Port test_pagination on Python 3
* test_pagination: use an empty string rather None as marker for
  bisect. On Python 3, a comparison between None and strings now
  raises a TypeError.
* Remove test_pagination from blacklist-py3.txt to run it on Python 3

Partially implements: blueprint trove-python3
Change-Id: I0c9c7d064ef7df2b15b40029264c33c9e9c9393e
2016-06-29 15:55:18 +02:00
Victor Stinner 71284ddc5f Run Python 3 unit tests in parallel
Replace testtools.run test runner with os-testr for Python 3 to run
tests in parallel.

Replace also the whitelist with a blacklist to quickly identify tests
which still must be ported to Python 3.

Blacklist backup.test_backup_models: even if it worked when run with
testtools.run, it fails when run using os-testr. We can investigate
this issue later, it's more important to reduce the duration of the
py34 job to reduce the risk of random timeout.

Add a dependency to os-testr.

Partially implements: blueprint trove-python3
Change-Id: I5ea7ebf7eec15b75a5fed07aab7bd15e5e6cd6d6
2016-06-22 09:23:47 +02:00