]> granicus.if.org Git - zziplib/commit
test: fix error message tests on non-glibc based systems
authorPatrick Steinhardt <ps@pks.im>
Wed, 22 May 2019 09:49:53 +0000 (11:49 +0200)
committerPatrick Steinhardt <ps@pks.im>
Thu, 1 Aug 2019 06:34:47 +0000 (08:34 +0200)
commit0fc1abfd355398fad6d956b888bb1f972969f2ce
treeeda53840bfcc865839f06130c7728965920c848f
parentac696c170751a2415e5cc7ba00ab4380e85c6cd2
test: fix error message tests on non-glibc based systems

Our tests makes strict assumptions on the error messages generated by
strerror(3P), but those aren't in any way required to have a special
text. This works just fine on glibc based systems, but causes us to
trigger asserts on other systems like e.g. musl based ones.

Fix this by introducing a new `assertErrorMessage` method. It'll take as
inputs the observed error message as well as the error code we expect
and then use `os.strerror` to compute the expected message. Like this,
we're not dependent anymore on how the system represents those error
messages but generate the expected ones on the fly.
test/zziptests.py