Fix unit tests as of 08/22
#1 Updated by Marco Mambelli about 1 month ago
- there are problems in the matching of jobs and resources
- there may be some calculation problem due to '/' being different from '//' also when using integers
- there may be some problem due to incorrect use of pickle. The protocol in python2 was ASCII content, so text files were OK (binary suggested). Not any more. And we have some code where pickle files are opened as text. I did a quick survey of the code: there are over 90 lines where pickle is used and need to be revised. See [#24931]
- There may be some problem w/ None values
Things need to be inspected and sometime exceptions temporary unmasked (we have some bare except: in the code)
Some notes about the fixes:
1. i found that the wrappers around M2Crypto had some bytes/str inconsistency that I fixed.
In particular a code like
str_str = "%s" % bytes_str was used many time (both %s or %r do the same) and produces the wrong result
b'CONTENT_OF_BYTES_STR' with 3 chars added,
b'', increasing the size of the string (there were some key size mismatch), this is a representation (more or less) of the variable, bytes must be decoded to become a string.
I added in lib/defaults.py constants and a function to help w/ conversions.
2. there was some splitting of bytes w/ str constants
3. some of the errors were in the unit tests
4. Lib fork was also failing because a str/bytes problem: pipes are bytes streams, I corrected that in several places
- note that one of the tests is failing on the mac because epoll is not available, works on Linux
5. None values were considered empty strings for sorting in Python2. None raises an exception in sorting of string values