Replace nose to nose2
because nose is in deprecation[1] so we need to use nose2, or pytests instead. This commit suggests to use nose2 and fix some import errors on slow attribute according to the docs [2] 1: https://nose.readthedocs.io/en/latest/#note-to-users 2: https://docs.nose2.io/en/latest/plugins/attrib.html Change-Id: Idc0c8c146a9ac7fa7ffd90793211422571852d82
This commit is contained in:
parent
e9187da3ea
commit
02e4f40ec9
@ -19,7 +19,7 @@ ant build_storlets
|
|||||||
SRC_DIR=$(cd $(dirname $0); pwd)
|
SRC_DIR=$(cd $(dirname $0); pwd)
|
||||||
cd ${SRC_DIR}/tests/functional
|
cd ${SRC_DIR}/tests/functional
|
||||||
if [ "$FLAVOR" == "jenkins" ]; then
|
if [ "$FLAVOR" == "jenkins" ]; then
|
||||||
nosetests --exe -v ${@:2}
|
nose2 -v ${@:2}
|
||||||
else
|
else
|
||||||
nosetests --exe -v -a '!slow' ${@:2}
|
nose2 -v -A '!slow' ${@:2}
|
||||||
fi
|
fi
|
||||||
|
@ -4,7 +4,7 @@ With that user just do:
|
|||||||
::
|
::
|
||||||
|
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install python-tox python-nose git
|
sudo apt-get install python-tox git
|
||||||
git clone https://opendev.org/openstack/storlets.git
|
git clone https://opendev.org/openstack/storlets.git
|
||||||
cd storlets
|
cd storlets
|
||||||
./s2aio.sh install
|
./s2aio.sh install
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
with_items:
|
with_items:
|
||||||
- python3
|
- python3
|
||||||
- python3-venv
|
- python3-venv
|
||||||
- python3-nose
|
|
||||||
- python3-pip
|
- python3-pip
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
hacking>=3.0.1,<3.1.0 # Apache-2.0
|
hacking>=3.0.1,<3.1.0 # Apache-2.0
|
||||||
|
|
||||||
coverage>=3.6
|
coverage>=3.6
|
||||||
nose
|
nose2
|
||||||
pexpect
|
pexpect
|
||||||
python-subunit>=0.0.18
|
python-subunit>=0.0.18
|
||||||
oslotest>=1.2.0 # Apache-2.0
|
oslotest>=1.2.0 # Apache-2.0
|
||||||
|
@ -19,7 +19,6 @@ import os
|
|||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
from swiftclient import client as c
|
from swiftclient import client as c
|
||||||
from nose.plugins.attrib import attr
|
|
||||||
from tests.functional.java import StorletJavaFunctionalTest
|
from tests.functional.java import StorletJavaFunctionalTest
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
@ -139,7 +138,6 @@ class TestSLO(StorletJavaFunctionalTest):
|
|||||||
f.close()
|
f.close()
|
||||||
self.ssertEqual(chunk, aux_content)
|
self.ssertEqual(chunk, aux_content)
|
||||||
|
|
||||||
@attr('slow')
|
|
||||||
def test_get_SLO(self):
|
def test_get_SLO(self):
|
||||||
headers = {'X-Run-Storlet': self.storlet_name}
|
headers = {'X-Run-Storlet': self.storlet_name}
|
||||||
headers.update(self.additional_headers)
|
headers.update(self.additional_headers)
|
||||||
@ -152,6 +150,8 @@ class TestSLO(StorletJavaFunctionalTest):
|
|||||||
headers=headers)
|
headers=headers)
|
||||||
self.compare_slo_to_chunks(body)
|
self.compare_slo_to_chunks(body)
|
||||||
|
|
||||||
|
test_get_SLO.slo = 1
|
||||||
|
|
||||||
|
|
||||||
class TestSloOnProxy(TestSLO):
|
class TestSloOnProxy(TestSLO):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -18,7 +18,6 @@ import os
|
|||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
from swiftclient import client as c
|
from swiftclient import client as c
|
||||||
from nose.plugins.attrib import attr
|
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from tests.functional.java import StorletJavaFunctionalTest
|
from tests.functional.java import StorletJavaFunctionalTest
|
||||||
import unittest
|
import unittest
|
||||||
@ -127,7 +126,6 @@ class TestIdentityStorlet(StorletJavaFunctionalTest):
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@attr('slow')
|
|
||||||
def test_put_10MB_file(self):
|
def test_put_10MB_file(self):
|
||||||
gf_file_path = '/tmp/10MB_file'
|
gf_file_path = '/tmp/10MB_file'
|
||||||
with self._filecontext(gf_file_path):
|
with self._filecontext(gf_file_path):
|
||||||
@ -149,6 +147,8 @@ class TestIdentityStorlet(StorletJavaFunctionalTest):
|
|||||||
status = response.get('status')
|
status = response.get('status')
|
||||||
self.assertIn(status, [200, 201])
|
self.assertIn(status, [200, 201])
|
||||||
|
|
||||||
|
test_put_10MB_file.slow = 1
|
||||||
|
|
||||||
def test_put(self):
|
def test_put(self):
|
||||||
self.invoke_storlet('PUT')
|
self.invoke_storlet('PUT')
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
import threading
|
import threading
|
||||||
from swiftclient import client as swift_client
|
from swiftclient import client as swift_client
|
||||||
from swiftclient import ClientException
|
from swiftclient import ClientException
|
||||||
from nose.plugins.attrib import attr
|
|
||||||
from storlets.tools.utils import get_member_auth
|
from storlets.tools.utils import get_member_auth
|
||||||
from tests.functional.java import StorletJavaFunctionalTest
|
from tests.functional.java import StorletJavaFunctionalTest
|
||||||
import unittest
|
import unittest
|
||||||
@ -100,10 +99,11 @@ class TestTestStorlet(StorletJavaFunctionalTest):
|
|||||||
def test_crash(self):
|
def test_crash(self):
|
||||||
self.invokeTestStorlet("crash")
|
self.invokeTestStorlet("crash")
|
||||||
|
|
||||||
@attr('slow')
|
|
||||||
def test_hold(self):
|
def test_hold(self):
|
||||||
self.invokeTestStorlet("hold")
|
self.invokeTestStorlet("hold")
|
||||||
|
|
||||||
|
test_hold.slow = 1
|
||||||
|
|
||||||
def invokeTestStorletinParallel(self):
|
def invokeTestStorletinParallel(self):
|
||||||
mythreads = []
|
mythreads = []
|
||||||
|
|
||||||
@ -117,10 +117,11 @@ class TestTestStorlet(StorletJavaFunctionalTest):
|
|||||||
for t in mythreads:
|
for t in mythreads:
|
||||||
t.join()
|
t.join()
|
||||||
|
|
||||||
@attr('slow')
|
|
||||||
def test_parallel_print(self):
|
def test_parallel_print(self):
|
||||||
self.invokeTestStorletinParallel()
|
self.invokeTestStorletinParallel()
|
||||||
|
|
||||||
|
test_parallel_print.slow = 1
|
||||||
|
|
||||||
def test_storlet_acl_get_fail(self):
|
def test_storlet_acl_get_fail(self):
|
||||||
headers = {'X-Run-Storlet': self.storlet_name}
|
headers = {'X-Run-Storlet': self.storlet_name}
|
||||||
headers.update(self.additional_headers)
|
headers.update(self.additional_headers)
|
||||||
|
@ -17,7 +17,6 @@ import json
|
|||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
from swiftclient import client
|
from swiftclient import client
|
||||||
from nose.plugins.attrib import attr
|
|
||||||
from tests.functional.python import StorletPythonFunctionalTest
|
from tests.functional.python import StorletPythonFunctionalTest
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
@ -104,7 +103,6 @@ class TestSLO(StorletPythonFunctionalTest):
|
|||||||
aux_content += f.read()
|
aux_content += f.read()
|
||||||
self.asertEqual(chunk, aux_content)
|
self.asertEqual(chunk, aux_content)
|
||||||
|
|
||||||
@attr('slow')
|
|
||||||
def test_get_SLO(self):
|
def test_get_SLO(self):
|
||||||
headers = {'X-Run-Storlet': self.storlet_name}
|
headers = {'X-Run-Storlet': self.storlet_name}
|
||||||
headers.update(self.additional_headers)
|
headers.update(self.additional_headers)
|
||||||
@ -117,6 +115,8 @@ class TestSLO(StorletPythonFunctionalTest):
|
|||||||
headers=headers)
|
headers=headers)
|
||||||
self.compare_slo_to_chunks(body)
|
self.compare_slo_to_chunks(body)
|
||||||
|
|
||||||
|
test_get_SLO.slow = 1
|
||||||
|
|
||||||
|
|
||||||
class TestSLOOnProxy(TestSLO):
|
class TestSLOOnProxy(TestSLO):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
from swiftclient import client
|
from swiftclient import client
|
||||||
from nose.plugins.attrib import attr
|
|
||||||
from tests.functional.python import StorletPythonFunctionalTest
|
from tests.functional.python import StorletPythonFunctionalTest
|
||||||
import unittest
|
import unittest
|
||||||
from urllib.request import Request, urlopen
|
from urllib.request import Request, urlopen
|
||||||
@ -79,7 +78,6 @@ class TestSimpleStorlet(StorletPythonFunctionalTest):
|
|||||||
response_dict=resp)
|
response_dict=resp)
|
||||||
self.assertEqual(204, resp['status'])
|
self.assertEqual(204, resp['status'])
|
||||||
|
|
||||||
@attr('slow')
|
|
||||||
def test_put_10MB_file(self):
|
def test_put_10MB_file(self):
|
||||||
with tempfile.NamedTemporaryFile() as f:
|
with tempfile.NamedTemporaryFile() as f:
|
||||||
with open(f.name, 'wb') as wf:
|
with open(f.name, 'wb') as wf:
|
||||||
@ -99,6 +97,8 @@ class TestSimpleStorlet(StorletPythonFunctionalTest):
|
|||||||
status = response.get('status')
|
status = response.get('status')
|
||||||
self.assertEqual(201, status)
|
self.assertEqual(201, status)
|
||||||
|
|
||||||
|
test_put_10MB_file.slow = 1
|
||||||
|
|
||||||
def test_copy_from(self):
|
def test_copy_from(self):
|
||||||
resp = dict()
|
resp = dict()
|
||||||
objname = self.storlet_file + '-copy'
|
objname = self.storlet_file + '-copy'
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
import threading
|
import threading
|
||||||
from swiftclient import client as swift_client
|
from swiftclient import client as swift_client
|
||||||
from swiftclient import ClientException
|
from swiftclient import ClientException
|
||||||
from nose.plugins.attrib import attr
|
|
||||||
from storlets.tools.utils import get_member_auth
|
from storlets.tools.utils import get_member_auth
|
||||||
from tests.functional.python import StorletPythonFunctionalTest
|
from tests.functional.python import StorletPythonFunctionalTest
|
||||||
import unittest
|
import unittest
|
||||||
@ -89,10 +88,11 @@ class TestTestStorlet(StorletPythonFunctionalTest):
|
|||||||
def test_crash(self):
|
def test_crash(self):
|
||||||
self.invoke_storlet("crash")
|
self.invoke_storlet("crash")
|
||||||
|
|
||||||
@attr('slow')
|
|
||||||
def test_hold(self):
|
def test_hold(self):
|
||||||
self.invoke_storlet("hold")
|
self.invoke_storlet("hold")
|
||||||
|
|
||||||
|
test_hold.slow = 1
|
||||||
|
|
||||||
def invoke_storlet_in_parallel(self):
|
def invoke_storlet_in_parallel(self):
|
||||||
mythreads = []
|
mythreads = []
|
||||||
|
|
||||||
@ -106,10 +106,11 @@ class TestTestStorlet(StorletPythonFunctionalTest):
|
|||||||
for t in mythreads:
|
for t in mythreads:
|
||||||
t.join()
|
t.join()
|
||||||
|
|
||||||
@attr('slow')
|
|
||||||
def test_parallel_print(self):
|
def test_parallel_print(self):
|
||||||
self.invoke_storlet_in_parallel()
|
self.invoke_storlet_in_parallel()
|
||||||
|
|
||||||
|
test_parallel_print.slow = 1
|
||||||
|
|
||||||
def test_storlet_acl_get_fail(self):
|
def test_storlet_acl_get_fail(self):
|
||||||
headers = {'X-Run-Storlet': self.storlet_name}
|
headers = {'X-Run-Storlet': self.storlet_name}
|
||||||
headers.update(self.additional_headers)
|
headers.update(self.additional_headers)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user