Mercurial > p > roundup > code
view test/test_instance.py @ 8215:1b15f635ada1
fix(web) issue2551382 - handle crash in request call in test
due to invalid utf8 with surrogate. Ci reports this failure in the
requests call from the test case:
> string = string.encode(encoding, errors)
E UnicodeEncodeError: 'utf-8' codec can't encode character
'\ud800' in position 48: surrogates not allowed
E Falsifying example:
test_class_url_param_accepting_integer_values(
E self=<test.test_liveserver.FuzzGetUrls
testMethod=test_class_url_param_accepting_integer_values>,
E param='@verbose', # or any other generated value
E value='\ud800',
E )
E Explanation:
E These lines were always and only run by failing
examples:
E
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/site-packages/requests/utils.py:675
E
E You can reproduce this example by temporarily adding
@reproduce_failure('6.122.3', b'AAAAAQDXAA==') as a decorator on your
test case
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Mon, 16 Dec 2024 19:19:07 -0500 |
| parents | 778a9f455067 |
| children | 9c3ec0a5c7fc |
line wrap: on
line source
# # Copyright (C) 2020 John Rouillard # All rights reserved. # For license terms see the file COPYING.txt. # from __future__ import print_function import unittest, os, shutil, errno, sys, difflib from roundup import instance from roundup.instance import TrackerError try: # python2 import pathlib2 as pathlib except ImportError: # python3 import pathlib from . import db_test_base class InstanceTest(unittest.TestCase): backend = 'anydbm' def setUp(self): self.dirname = '_test_instance' # set up and open a tracker self.instance = db_test_base.setupTracker(self.dirname, self.backend) # open the database self.db = self.instance.open('admin') self.db.commit() self.db.close() def tearDown(self): if self.db: self.db.close() try: shutil.rmtree(self.dirname) except OSError as error: if error.errno not in (errno.ENOENT, errno.ESRCH): raise def testOpenOldStyle(self): pathlib.Path(os.path.join(self.dirname, "dbinit.py")).touch() # no longer support old style tracker configs self.assertRaises(TrackerError, instance.open, self.dirname)
