1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 14:56:14 +01:00
Commit Graph

15 Commits

Author SHA1 Message Date
25a6e04e2b Run tests via calling 'setup.py test' 2022-03-29 14:01:55 +02:00
Marcus Huewe
3d21f2498b Merge branch 'tests_python3_fixes' of https://github.com/marcus-h/osc
Make the testsuite work with python3.8
2020-06-04 12:00:14 +02:00
Marcus Huewe
443e3ef90b tests: Ignore the ordering of attributes in XML documents
Old xml.etree.cElementTree versions (python2) reorder the attributes
while recent xml.etree.cElementTree versions (python3) keep the
document order.

Example:

python3:
>>> ET.tostring(ET.fromstring('<foo y="foo" x="bar"/>'))
b'<foo y="foo" x="bar" />'
>>>

python2:
>>> ET.tostring(ET.fromstring('<foo y="foo" x="bar"/>'))
'<foo x="bar" y="foo" />'
>>>

So far, the testsuite compared two serialized XML documents via a simple
string comparison. For instance via,
self.assertEqual(actual_serialized_xml, expected_serialized_xml) where
the expected_serialized_xml is, for instance, a hardcoded str. Obviously,
this would only work for python2 or python3.
In order to support both python versions, we first parse both XML
documents and then compare the corresponding trees (this is OK because
we do not care about comments etc.).

A related issue is the way how the testsuite compares data that is "send"
to the API. So far, this was a plain bytes comparison. Again, this won't
work in case of XML documents (see above). Moreover, we have currently
no notion to "indicate" that the transmitted data is an XML document.
As a workaround, we keep the plain bytes comparison and in case it fails,
we try an xml comparison (see above) as a last resort. Strictly speaking,
this is "wrong" (there might be cases (in the future) where we want to
ensure that the transmitted XML data is bit identical to a fixture file)
but a reasonable comprise for now.

Fixes: #751 ("[python3.8] Testsuite fails")
2020-06-03 21:50:50 +02:00
Adam Williamson
13a13a87c4 Fix ElementTree imports for Python 3.9
Importing `cElementTree` has been deprecated since Python 3.3 -
importing `ElementTree` automatically uses the fastest
implementation available - and is finally removed in Python 3.9.
Importing cElementTree directly (not as part of xml) is an even
older relic, it's for Ye Time Before ElementTree Was Added To
Python and it was instead an external module...which was before
Python 2.5.

We still need to work with Python 2.7 for now, so we use a try/
except to handle both 2.7 and 3.9 cases. Also, let's not repeat
this import 12 times in one file for some reason.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2020-06-02 15:13:10 -07:00
e1fd0b4ee9 add support for approved requests (requires OBS 2.10) 2018-10-18 13:26:39 +02:00
Marcus Huewe
6965dc5cd4 Adjust request testcases to the upcoming Request api change
There is no need to compute the request creator, because it is
stored in the request xml. Moreover, the old computation yields
a wrong result (see issue #286).
2017-04-12 12:55:16 +02:00
a031dbd083 show review comments in an own line. Before they started in the same line, but reached on typical
screens anyway the second line if they had more than a few chars.
2015-08-13 08:07:34 +02:00
7b79298138 - fix test case for showing update link 2015-03-09 09:04:33 +01:00
3d07bd8460 - fix description rendering in history elements 2014-09-11 14:34:22 +02:00
Ludwig Nussel
f065dc4765 show source revision in submit requests 2014-02-27 16:46:49 +01:00
Sascha Peilicke
af86600880 Fix tests/test_request.py, requests seem to have a trainling newline now 2011-08-18 16:02:34 +02:00
Marcus Huewe
73ffb036f8 - test_request: test get_actions method 2011-01-29 17:43:36 +01:00
Marcus Huewe
dda670f3de - test_request: adjusted testcase to the latest format changes 2011-01-24 09:34:37 +01:00
Marcus Huewe
e1b1f66bae - TestRequest: added testcase for action element with acceptinfo subelement 2011-01-12 22:20:47 +01:00
Marcus Huewe
8c26c74620 - added testcases for the rewritten Request class 2010-12-30 02:27:15 +01:00