Commit graph

174 commits

Author SHA1 Message Date
Pavel Raiskup
10b315b1a5 tests: adapt test_undo_tag() to the master → main change 2024-11-06 11:19:55 +01:00
Pavel Raiskup
d220002bf0 tests: unittests assertEquals() is now assertEqual() 2024-11-06 11:19:55 +01:00
Pavel Raiskup
b895acb7db tests: modernize import statements 2024-11-06 11:19:55 +01:00
Jakub Kadlcik
2ad7a823dd Replace egrep with grep -E
egrep: warning: egrep is obsolescent; using grep -E
2023-08-14 14:15:32 +02:00
Jakub Kadlcik
d41626d181 Print filenames that doesn't comply PEP8
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)
2021-01-12 16:27:27 +01:00
Jakub Kadlcik
998f7fb067 Make tests working on systems without non-versioned python macros
See RHBZ 1784688

We are using unversioned python macros, such as `%__python` and
`%python_sitelib` which are not supported in Fedora rawhide
anymore. Instead, we should use `%__python3` and `%python3_sitelib`.
2020-10-12 11:39:27 +02:00
Jakub Kadlčík
27cb63e043
Merge pull request #374 from FrostyX/less-aggressive-yes-or-no
Make yes or no input less aggressive
2020-05-04 10:55:53 +02:00
Jakub Kadlcik
ad74e00a77 Make yes or no input less aggressive
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.
2020-04-26 14:13:35 +02:00
Jakub Kadlcik
ecd5718f62 Define a small abstraction for mocking builtins
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.
2020-04-26 14:13:35 +02:00
Jakub Kadlcik
3a62bb6613 Move bugzilla code to a separate file
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`.
2020-04-24 18:22:17 +02:00
Jakub Kadlcik
219efc50a2 Add a possibility to have full datetime entries in changelog
Fix #305

Unfortunatelly we need to use `pytz` instead of `datetime.timezone`
because of python2.
2020-04-24 17:41:00 +02:00
Jakub Kadlcik
a72d4fbe50 Move is_rawhide and is_epel6 definitions to __init__ so other tests can use it 2020-04-23 11:35:03 +02:00
Jakub Kadlčík
3bb01ebb56
Merge pull request #333 from evgeni/get_project_name
make get_project_name more resilient
2020-03-09 10:40:17 +01:00
Jakub Kadlcik
1929f7f5a0 Temporarily skip some createrepo_c tests because it coredumps
This is probably not our fault, createrepo_c coredumps on Fedora
rawhide, please see the upstream issue
https://github.com/rpm-software-management/createrepo_c/issues/202

Once it gets resolved, revert this commit.
2020-01-31 21:23:17 +01:00
Evgeni Golov
fef2cfd161 add tests for get_package_name 2020-01-31 14:08:10 +01:00
Jakub Kadlcik
8afe478b97 Temporarily disable checks for E7 and W6 2020-01-30 23:31:36 +01:00
Jakub Kadlcik
b7d64be5d0 Fix E305 PEP8 error
> expected 2 blank lines after end of function or class
2020-01-30 23:31:36 +01:00
Jakub Kadlcik
30f59ec027 Use pycodestyle pacakge when pep8 is not available 2020-01-30 23:31:34 +01:00
Ernestas Kulik
3a79fdde9f Move to python-blessed
As python-blessings is unmaintained nowadays and is not packaged for
EPEL 8, it might be good to move to an active fork.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1777377
2020-01-13 09:04:38 +01:00
Miroslav Suchý
9c3f00f2cf Partial revert "Fix #335. Handle source tarballs with UTF8 characters in the name."
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
2019-10-03 09:35:24 +02:00
Alex Wood
03509b36d5 Fix #335. Handle source tarballs with UTF8 characters in the name.
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.
2019-04-10 14:20:02 -04:00
Alex Wood
fc12574880 BuildRoot is long deprecated and caused tests to fail. 2019-04-08 17:10:17 -04:00
Devan Goodwin
3e3a6f8aca Merge pull request #287 from pfournier/no-dist-release-line
Don't append 'None' to Release line with no '%{?dist}' part
2017-08-29 12:28:59 -03:00
Patrice Fournier
2a89594819 Don't append 'None' to Release line with no '%{?dist}' part 2017-08-29 09:28:09 -04:00
Evgeni Golov
e4746a6838 also verify that ReleaseTagger supports --use-release 2017-05-22 09:05:33 +02:00
Evgeni Golov
dfbf502749 add test for ReleaseTagger together with --use-version 2017-05-22 08:53:24 +02:00
Vadim Rutkovsky
aadafd4e87 Custom tag support in tito release
Signed-off-by: Vadim Rutkovsky <vrutkovs@redhat.com>
2017-05-05 12:35:23 +02:00
Vadim Rutkovsky
3a08af27ce VersionTagger should support custom tag format
It allows projects to format their own tags
2017-04-28 17:03:35 +02:00
Steve Kuznetsov
ed0d21708b
Use .assertTrue() instead of .assertIn()
CentOS 6 only has Python 2.6 available, on which the unit testing
frameworks do not expose a `.assertIn()` helper method. Instead, we can
use `.assertTrue(x in y)`.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
2017-01-26 15:54:41 -05:00
Steve Kuznetsov
4f36972414
Clean up artifacts before test runs, not after
When tests fail, artifacts from that tests are necessary to properly
debug the failure and determine how to fix the test. This is impossible
when artifacts are immediately removed after the test is finished.
Instead, the tests should remove old artifacts before the test run
begins.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
2017-01-09 10:00:31 -05:00
Steve Kuznetsov
a19a366213
Added --use-release flag for tito tag
When multiple tags exist for one version of a project, or when a version
is passed to `tito tag --use-version` that does not exactly correspond
with a tag in the repository's git history, the auto-generated release
is not guaranteed to monotonically increase. In order for users to
overcome this issue without building complicated logic into `tito`, it
is simpler to allow users to provide a literal release string to use.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
2017-01-09 10:00:31 -05:00
Martin Sehnoutka
074b129ad7 Fix unit tests. 2016-12-15 15:05:25 +01:00
Martin Sehnoutka
f80debc740 Comments for test class. 2016-12-15 11:19:38 +01:00
Martin Sehnoutka
4d373ee201 Functional test case for CargoBump class. 2016-12-15 11:14:06 +01:00
Martin Sehnoutka
f7014b7527 Rename CargoTagger as CargoBump 2016-11-30 16:19:48 +01:00
Sehny
9bc7a0f76f fix few pep8 errors 2016-11-21 18:51:34 +01:00
Sehny
5da7997995 2 unit tests for cargo tagger. 2016-11-21 18:16:05 +01:00
Sehny
0efa60a77b Add unit test class 2016-11-21 13:31:31 +01:00
Lubomír Sedlář
a86501c1b5 Allow customizing git commit message 2016-05-27 09:46:19 +02:00
Dominic Cleal
de9ef27b3f
Only pass one project_name to copr build command 2016-05-11 18:44:17 +01:00
Devan Goodwin
5d258e7d2e Fix bugs with %autosetup and --test builds.
Extract method, add some tests, and fixed the regex problem.
2016-04-14 16:08:34 -03:00
Eric D Helms
092dc1e6c5 Add ability to specify a custom changelog during tag 2016-04-07 14:04:44 -04:00
Jakub Kadlčík
fa945d5875 Change asserted behavior after fe4c0bf 2015-09-10 13:28:21 +02:00
Alex Wood
3b99185216 Allow a user specific Copr remote SRPM URL.
By using a user specific URL, multiple members of the same team can
submit Copr releases without having to share credentials to the SRPM
remote location.  For example, each member of the team can set
COPR_REMOTE_LOCATION in .titorc to their <username>.fedorapeople.org
space.
2015-07-24 14:05:53 -04:00
Dominic Cleal
8d66889981 Fix rpmbuild_options array handling from builder args
3892359 changed builder args to always be arrays, so concatenation of
rpmbuild options with other strings then failed.

    File "/usr/lib/python2.7/site-packages/tito/release/main.py", line 530, in _koji_release
      builder.srpm(dist=disttag)
    File "/usr/lib/python2.7/site-packages/tito/builder/main.py", line 210, in srpm
      rpmbuild_options = self.rpmbuild_options + self._scl_to_rpmbuild_option()
    TypeError: can only concatenate list (not "str") to list

Change builder args to be joined by a single space, allowing multiple
arguments to be passed in.
2015-06-24 14:19:42 +01:00
Alex Wood
593f702372 Provide ability to turn off colored output. Fixes #182. 2015-06-15 11:02:18 -04:00
Alex Wood
356184c428 Correct style errors and use all caps for user_config option. 2015-06-12 13:36:25 -04:00
Alex Wood
d73ab2d661 Replace old Perl script for munging RPM release number. 2015-06-10 18:31:36 -04:00
Alex Wood
9b1d1c6988 Silence spurious test output. 2015-06-04 17:50:33 -04:00
Alex Wood
a5b43b6b96 Fix Python 3 issues with binary versus string types.
Python 3 is very picky about not mixing binary and string data.  This
patch gets TarFixer running on both Python 2.6+ and Python 3.x.
2015-05-18 14:01:43 -04:00