mirror of
https://github.com/rpm-software-management/tito.git
synced 2025-02-23 20:22:46 +00:00
Start a runtests.py script to setup a faux git repo for testing.
We'll soon be running 'unit' tests inside this git repo to ensure tito does what it's supposed to do.
This commit is contained in:
parent
a791b8a8c4
commit
333b28663b
4 changed files with 40 additions and 0 deletions
1
test/fakegitfiles/a.txt
Normal file
1
test/fakegitfiles/a.txt
Normal file
|
@ -0,0 +1 @@
|
|||
blah blah blah
|
1
test/fakegitfiles/b.txt
Normal file
1
test/fakegitfiles/b.txt
Normal file
|
@ -0,0 +1 @@
|
|||
omg omg omg
|
1
test/fakegitfiles/c.txt
Normal file
1
test/fakegitfiles/c.txt
Normal file
|
@ -0,0 +1 @@
|
|||
bbq bbq bbq
|
37
test/runtests.py
Normal file
37
test/runtests.py
Normal file
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import os
|
||||
import os.path
|
||||
|
||||
# Python libraries are one level up from where this script lives:
|
||||
TEST_SCRIPT_DIR = os.path.dirname(sys.argv[0])
|
||||
sys.path.append(os.path.join(TEST_SCRIPT_DIR, "../src/"))
|
||||
|
||||
import spacewalk.releng.cli # prevents a circular import
|
||||
from spacewalk.releng.common import *
|
||||
|
||||
# A location where we can safely create a test git repository.
|
||||
# WARNING: This location will be destroyed if present.
|
||||
TEST_GIT_LOCATION = '/tmp/tito-test-git-repo'
|
||||
|
||||
if __name__ == '__main__':
|
||||
print "Running tito tests."
|
||||
|
||||
if os.path.exists(TEST_GIT_LOCATION):
|
||||
#error_out("Test Git repo already exists: %s" % TEST_GIT_LOCATION)
|
||||
run_command('rm -rf %s' % TEST_GIT_LOCATION)
|
||||
|
||||
run_command('mkdir -p %s' % TEST_GIT_LOCATION)
|
||||
run_command('cp -R %s/* %s' % (os.path.join(TEST_SCRIPT_DIR,
|
||||
'fakegitfiles'), TEST_GIT_LOCATION))
|
||||
os.chdir(TEST_GIT_LOCATION)
|
||||
run_command('git init')
|
||||
run_command('git add a.txt')
|
||||
run_command('git commit -a -m "added a.txt"')
|
||||
run_command('git add b.txt')
|
||||
run_command('git commit -a -m "added b.txt"')
|
||||
run_command('git add c.txt')
|
||||
run_command('git commit -a -m "added c.txt"')
|
||||
|
||||
|
Loading…
Add table
Reference in a new issue