projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
18676: Merge branch 'main' into 18676-anon-token-improvement
[arvados.git]
/
services
/
fuse
/
tests
/
test_command_args.py
diff --git
a/services/fuse/tests/test_command_args.py
b/services/fuse/tests/test_command_args.py
index 9f6555de33278efb1b83648826a17f527a85bc66..ed59029628a5cdf0a5d7e5420d8680cb11039086 100644
(file)
--- a/
services/fuse/tests/test_command_args.py
+++ b/
services/fuse/tests/test_command_args.py
@@
-4,6
+4,7
@@
from __future__ import absolute_import
from __future__ import print_function
from __future__ import absolute_import
from __future__ import print_function
+from six import assertRegex
import arvados
import arvados_fuse
import arvados_fuse.command
import arvados
import arvados_fuse
import arvados_fuse.command
@@
-34,11
+35,12
@@
def noexit(func):
@contextlib.contextmanager
def nostderr():
@contextlib.contextmanager
def nostderr():
- orig, sys.stderr = sys.stderr, open(os.devnull, 'w')
- try:
- yield
- finally:
- sys.stderr = orig
+ with open(os.devnull, 'w') as dn:
+ orig, sys.stderr = sys.stderr, dn
+ try:
+ yield
+ finally:
+ sys.stderr = orig
class MountArgsTest(unittest.TestCase):
class MountArgsTest(unittest.TestCase):
@@
-81,13
+83,13
@@
class MountArgsTest(unittest.TestCase):
e = self.check_ent_type(arvados_fuse.StringFile, 'README')
readme = e.readfrom(0, -1).decode()
e = self.check_ent_type(arvados_fuse.StringFile, 'README')
readme = e.readfrom(0, -1).decode()
-
self.assertRegexpMatches(
readme, r'active-user@arvados\.local')
-
self.assertRegexpMatches(
readme, r'\n$')
+
assertRegex(self,
readme, r'active-user@arvados\.local')
+
assertRegex(self,
readme, r'\n$')
e = self.check_ent_type(arvados_fuse.StringFile, 'by_id', 'README')
txt = e.readfrom(0, -1).decode()
e = self.check_ent_type(arvados_fuse.StringFile, 'by_id', 'README')
txt = e.readfrom(0, -1).decode()
-
self.assertRegexpMatches(
txt, r'portable data hash')
-
self.assertRegexpMatches(
txt, r'\n$')
+
assertRegex(self,
txt, r'portable data hash')
+
assertRegex(self,
txt, r'\n$')
@noexit
def test_by_id(self):
@noexit
def test_by_id(self):
@@
-187,8
+189,8
@@
class MountArgsTest(unittest.TestCase):
def test_version_argument(self):
# The argparse version action prints to stderr in Python 2 and stdout
def test_version_argument(self):
# The argparse version action prints to stderr in Python 2 and stdout
- # in Python 3.4 and up. Write both to the same stream so the test can pass
- # in both cases.
+ # in Python 3.4 and up. Write both to the same stream so the test can pass
+ # in both cases.
origerr = sys.stderr
origout = sys.stdout
sys.stderr = io.StringIO()
origerr = sys.stderr
origout = sys.stdout
sys.stderr = io.StringIO()
@@
-196,7
+198,7
@@
class MountArgsTest(unittest.TestCase):
with self.assertRaises(SystemExit):
args = arvados_fuse.command.ArgumentParser().parse_args(['--version'])
with self.assertRaises(SystemExit):
args = arvados_fuse.command.ArgumentParser().parse_args(['--version'])
-
self.assertRegexpMatches(
sys.stdout.getvalue(), "[0-9]+\.[0-9]+\.[0-9]+")
+
assertRegex(self,
sys.stdout.getvalue(), "[0-9]+\.[0-9]+\.[0-9]+")
sys.stderr.close()
sys.stderr = origerr
sys.stdout = origout
sys.stderr.close()
sys.stderr = origerr
sys.stdout = origout