search for: assertraises

Displaying 12 results from an estimated 12 matches for "assertraises".

Did you mean: assert_raises
2016 May 04
9
[PATCH 0/8] python: PEP 8 fixes
Hi, this series cleans up the Python sources, either static or generated, including also tests, to make them PEP 8 compliant; see https://www.python.org/dev/peps/pep-0008/ and tools like pep8. Almost all the issues reported by pep8 are fixed, reducing the issues from 3818 to 7. The changes should have no effect on the actual code, while it will help Python users with consistency with other
2016 Feb 22
3
[PATCH 1/3] python: tests: refactor to use unittest's discovery
...SA. - -# Test all the different return values. - -import unittest -import guestfs - - -class Test090PythonRetValues (unittest.TestCase): - def test_rint (self): - g = guestfs.GuestFS () - - self.assertAlmostEqual (g.internal_test_rint ("10"), 10, places=1) - - self.assertRaises (RuntimeError, g.internal_test_rinterr) - - - def test_rint64 (self): - g = guestfs.GuestFS () - - self.assertAlmostEqual (g.internal_test_rint64 ("10"), 10L, places=1) - - self.assertRaises (RuntimeError, g.internal_test_rint64err) - - - def test_rbool (self):...
2016 Feb 12
2
[PATCH] python: tests: use more targeted assert*() functions/checks
- use assertIsInstance, assertNotEqual, and assertIsNotNone as more specific checks (will produce better logging) - use assertRaises when expecting exceptions being thrown - when testing internal_test_rhashtable, instead of checking type and elements of the return values just check the return value as a whole (easier and already getting all the work needed by unittest) --- python/t/080-version.py | 6 +++--- python/t...
2016 Feb 15
1
[PATCH] Start adding return values tests for bindings
...SA. + +# Test all the different return values. + +import unittest +import guestfs + + +class Test090PythonRetValues (unittest.TestCase): + def test_rint (self): + g = guestfs.GuestFS () + + self.assertAlmostEqual (g.internal_test_rint ("10"), 10, places=1) + + self.assertRaises (RuntimeError, g.internal_test_rinterr) + + + def test_rint64 (self): + g = guestfs.GuestFS () + + self.assertAlmostEqual (g.internal_test_rint64 ("10"), 10L, places=1) + + self.assertRaises (RuntimeError, g.internal_test_rint64err) + + + def test_rbool (self):...
2016 Feb 12
1
Re: [PATCH] python: tests: use more targeted assert*() functions/checks
On Friday 12 February 2016 17:13:17 Richard W.M. Jones wrote: > On Fri, Feb 12, 2016 at 06:04:47PM +0100, Pino Toscano wrote: > > - use assertIsInstance, assertNotEqual, and assertIsNotNone as more > > specific checks (will produce better logging) > > - use assertRaises when expecting exceptions being thrown > > - when testing internal_test_rhashtable, instead of checking type and > > elements of the return values just check the return value as a whole > > (easier and already getting all the work needed by unittest) > > Good find! I w...
2016 Feb 12
0
Re: [PATCH] python: tests: use more targeted assert*() functions/checks
On Fri, Feb 12, 2016 at 06:04:47PM +0100, Pino Toscano wrote: > - use assertIsInstance, assertNotEqual, and assertIsNotNone as more > specific checks (will produce better logging) > - use assertRaises when expecting exceptions being thrown > - when testing internal_test_rhashtable, instead of checking type and > elements of the return values just check the return value as a whole > (easier and already getting all the work needed by unittest) Good find! I was going by the documenta...
2016 Feb 22
0
[PATCH 3/3] python: tests: fix long/int mismatch in test090RetValues.py
...onRetValues (unittest.TestCase): def test_rint64 (self): g = guestfs.GuestFS () - self.assertAlmostEqual (g.internal_test_rint64 ("10"), 10L, places=1) + self.assertAlmostEqual (g.internal_test_rint64 ("10"), int_type (10), places=1) self.assertRaises (RuntimeError, g.internal_test_rint64err) -- 2.5.0
2017 May 09
1
[PATCH] RHBZ#1406906: check return value of Python object functions
...mount("/dev/sda1", "/") + + # touch file with illegal unicode character + open(os.path.join(self.tempdir, "\udcd4"), "w").close() + + g.copy_in(self.tempdir, "/") + + if sys.version_info.major == 3: + with self.assertRaises(UnicodeDecodeError): + g.find("/") # segfault here on Python 3 -- 2.11.0
2017 May 06
5
[Bug 1406906] [PATCH 0/3] Fix segmentation fault in Python bindings
This series addresses the issue where non UTF8 file names in a guest image lead to libguestfs segfault with Python 3 APIs. The core issue is the APIs are not checking the return value when constructing a new PyObject. Therefore NULL pointers are added to Python collections (lists and dictionaries) crashing the application. Few notes regarding the comments on the previous patch. - Added a
2017 May 11
1
[PATCH v2] RHBZ#1406906: check return value of Python object functions
...+ + # touch file with illegal unicode character + non_utf8_fname = "\udcd4" + open(os.path.join(self.tempdir, non_utf8_fname), "w").close() + + g.copy_in(self.tempdir, "/") + + if sys.version_info >= (3, 0): + with self.assertRaises(UnicodeDecodeError): + g.find("/") # segfault here on Python 3 + elif sys.version_info >= (2, 0): + self.assertTrue( + any(path for path in g.find("/") if non_utf8_fname in path)) -- 2.11.0
2020 Jan 10
8
[PATCH 0/7] Various Python pycodestyle fixes
Fixes the majority of the pycodestyle issues in the Python bindings, leaving only an overly length line in setup.py. Add a simple optional pycodestyle-based test to avoid regressions in the future. Pino Toscano (7): python: PEP 8: adapt empty lines python: PEP 8: adapt whitespaces in lines python: tests: catch specific exception python: tests: improve variable naming python: tests:
2020 Jan 10
9
[PATCH v2 0/8] Various Python pycodestyle fixes
Fixes all the pycodestyle issues in the Python bindings, overring one that does not make sense to change (and it's in setup.py, so almost irrelevant). Add a simple optional pycodestyle-based test to avoid regressions in the future. Pino Toscano (8): python: PEP 8: adapt empty lines python: PEP 8: adapt whitespaces in lines python: tests: catch specific exception python: tests: