- Requires us to add pytest.ini to tell pytest where to look for test
files, and set the python path.
- Mock drops terminal from the tested code, so we have to "mock" it in
test_colors()
- Enable coverage in tox tests.
The old output was missing filenames, e.g.
AssertionError: Found PEP8 errors that may break your code in Python 3:
2 E201 whitespace after '['
3 E202 whitespace before ']'
2 E203 whitespace before ':'
1 E221 multiple spaces before operator
1 E302 expected 2 blank lines, found 1
2 E303 too many blank lines (2)
That's now usefull at all. Where the heck should I search for these errors. The
new output is a little bit messy but contains more usefull information, e.g.
AssertionError: Found PEP8 errors that may break your code in Python 3:
/tito/test/unit/../../src/tito/release/LocalYumRepo.py:9:1: E302 expected 2 blank lines, found 1
/tito/test/unit/../../src/tito/release/LocalYumRepo.py:17:66: E202 whitespace before ']'
/tito/test/unit/../../src/tito/release/LocalYumRepo.py:21:15: E203 whitespace before ':'
/tito/test/unit/../../src/tito/release/LocalYumRepo.py:22:16: E203 whitespace before ':'
/tito/test/unit/../../src/tito/release/LocalYumRepo.py:26:18: E201 whitespace after '['
/tito/test/unit/../../src/tito/release/LocalYumRepo.py:26:32: E202 whitespace before ']'
/tito/test/unit/../../src/tito/release/LocalYumRepo.py:29:15: E201 whitespace after '['
/tito/test/unit/../../src/tito/release/LocalYumRepo.py:29:32: E202 whitespace before ']'
/tito/test/unit/../../src/tito/release/LocalYumRepo.py:35:17: E221 multiple spaces before operator
/tito/test/unit/../../src/tito/release/LocalYumRepo.py:76:5: E303 too many blank lines (2)
Fix#364
Previously all non-yes input was considered to be "no". Which is not
what we typically want. There should be expected "yes" inputs, expected
"no" inputs and everything else should be considered to be an uknown
input and should be treated this way.
I think that printing an error for unknown input is too verbose and have
no added value. Simply repeating the question is the way to go here:
##### Please review the above diff #####
Do you wish to proceed with commit? [y/n] foo
Do you wish to proceed with commit? [y/n] y
Proceeding with commit.
It's better to do the python2 and python3 compatibility magic on
one place rather than having having `if PY2` conditions everywhere
and figuring whether to use `builtins.foo` or `__builtin__.foo
over and over again.
Fix#358
Previously the bugzilla-specific code was implemented in `tito.common`
which is imported from everywhere. Therefore missing dependency
to `python3-bugzilla` resulted in failure even for simple commands
such as `tito build --tgz`.
This partialy reverts commit 03509b36d5.
It removes just test and keep the functionality.
The test cannot be there right now because tito 0.6.11 and older will choke on this and will produce demaged tarball.
This revert can be added back later when all devel has tito in version 0.6.12 or higher.
Resolves: #337
Following the principals of https://nedbatchelder.com/text/unipain.html
our goal is to decode bytes in to unicode as soon as we read them and
encode unicode date to bytes at the last second.
The specific problem we were seeing was caused by calling "encode" on a
byte string rather than a unicode string. Python attempts to be
"helpful" and tries to decode the bytes as ASCII in order to provide a
unicode string to the encode function. Since the bytes aren't ASCII,
the decode fails and we get the UnicodeDecodeError despite the fact that
we never explicitly asked for a decode at all.
Also, calculate checksums correctly for tarballs that have files with
UTF8 characters in the file name.
These tests began failing after a correction to another test. The
other test had been patching the error_out function without unpatching
it and thus polluted the test environment.
Also reset to a known directory at the beginning of the common tests so
that we don't start in a directory that has since been unlinked.
The Maven-generated tar file deviates from the spec in several places.
Fields are padded out with spaces instead of NUL bytes and the user and
group ID are left empty.
This patch alters the tar module to correct these issues and ensures a
consistent unchanging fingerprint for the archive by setting the mtime
on the files to the modified time of the commit.
The Python 2.4 style of getting an exception object is forbidden by the
test_exceptions_3 test. Something has to give, and Tito is not being
built for RHEL 5 anymore.
Python's read(N) function only guarantees that it will read no more
than N bytes but not that it will return N bytes. This patch adds a
function that will ensure exactly N bytes are read.
Tito passes "git archive" a tree ID. The "git archive" man page states:
git archive behaves differently when given a tree ID versus when
given a commit ID or tag ID. In the first case the current time
is used as the modification time of each file in the archive.
Using the current time means that every time we build the source
tarball, the file fingerprint will change since the metadata in the
tarball changes. We don't want that since build systems track the
fingerprint to see if the actual source has changed.
This process was previously handled in an enigmatic Perl script that
lacked any comments whatsoever. Converting it to well-commented Python
makes the process less mysterious and speedier since Tito doesn't need
to shell out to Perl.