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>
Particularly useful when creating new projects and wanting to avoid
creating an initial tag, this allows `tito build --test --srpm` etc
to run without any tag.
resolves from a73c90cb...
Using Python 2.4
Using nose 0.1
Running tito tests against: /home/sandbox/src
EEEE.Warning: spacewalk.releng.* namespace in tito.props is obsolete. Use tito.* instead.
Warning: spacewalk.releng.* namespace in tito.props is obsolete. Use tito.* instead.
..............................F...........
======================================================================
ERROR: Failure: SyntaxError (invalid syntax (fixture.py, line 159))
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/nose/loader.py", line 381, in loadTestsFromName
module = self.importer.importFromPath(
File "/usr/lib/python2.4/site-packages/nose/importer.py", line 39, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/usr/lib/python2.4/site-packages/nose/importer.py", line 86, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/home/sandbox/test/functional/fetch_tests.py", line 27, in ?
from fixture import TitoGitTestFixture, tito
File "/home/sandbox/test/functional/fixture.py", line 159
with open(os.path.join(full_pkg_dir, 'tito.props'), 'w') \
^
SyntaxError: invalid syntax
GitPython's git.util.get_user_id() calls os.getlogin(), which
throws an OSError if there is no tty:
Traceback (most recent call last):
File "/home/sandbox/test/functional/multiproject_tests.py", line 65, in setUp
TitoGitTestFixture.setUp(self)
File "/home/sandbox/test/functional/fixture.py", line 129, in setUp
index.commit('Setting offline.')
File "/usr/lib/python2.7/site-packages/git/index/base.py", line 887, in commit
return Commit.create_from_tree(self.repo, tree, message, parent_commits, head)
File "/usr/lib/python2.7/site-packages/git/objects/commit.py", line 303, in create_from_tree
committer = Actor.committer(cr)
File "/usr/lib/python2.7/site-packages/git/util.py", line 354, in committer
return cls._main_actor(cls.env_committer_name, cls.env_committer_email, config_reader)
File "/usr/lib/python2.7/site-packages/git/util.py", line 327, in _main_actor
default_email = get_user_id()
File "/usr/lib/python2.7/site-packages/git/util.py", line 120, in get_user_id
username = os.getlogin()
OSError: [Errno 25] Inappropriate ioctl for device
But GitPython also allows to avoid the call by setting
environment variable "USER" to anything other than "UNKNOWN".
Therefore we preempt GitPython by calling os.getlogin() ourselves.
If we have to rescue the exception, export the environment var to
avoid traceback.
This allows the behaviour to be used in just about any tagger sub-class.
Behaviour will be triggered on the presence of the 'version_template'
section in tito.props.
Renamed config:
version -> version_template (section)
file -> destination_file
Separated the replacement of version and release, as caller may just
want one or the other. (it works fine if only one of the variables is
present in your template file) Release is more of an rpm concept so may
not always be wanted in this context.
Removed the notion of default template files, if you want to use this
you need to specify the configuration for it.
Added a functional test to make sure I keep it working.