1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-09 22:36:14 +01:00

Run tests via calling 'setup.py test'

This commit is contained in:
Daniel Mach 2022-02-17 13:28:47 +01:00
parent cb4b2389a6
commit 25a6e04e2b
19 changed files with 31 additions and 81 deletions

3
README
View File

@ -258,6 +258,5 @@ chmod 0600 ~/.w3m/passwd
NOTES about the testsuite
A new test suite has been created and should run via doing
# cd tests
# python suite.py
# ./setup.py test

View File

@ -135,4 +135,5 @@ setuptools.setup(
'build_docs': build_docs,
'install_data': install_data
},
test_suite="tests",
)

0
tests/__init__.py Normal file
View File

View File

@ -1,50 +0,0 @@
import os.path
import sys
import unittest
try:
import xmlrunner # JUnit like XML reporting
have_xmlrunner = True
except ImportError:
have_xmlrunner = False
import test_update
import test_addfiles
import test_deletefiles
import test_revertfiles
import test_difffiles
import test_init_package
import test_init_project
import test_commit
import test_repairwc
import test_package_status
import test_project_status
import test_request
import test_setlinkrev
import test_prdiff
import test_results
import test_helpers
suite = unittest.TestSuite()
suite.addTests(test_addfiles.suite())
suite.addTests(test_deletefiles.suite())
suite.addTests(test_revertfiles.suite())
suite.addTests(test_update.suite())
suite.addTests(test_difffiles.suite())
suite.addTests(test_init_package.suite())
suite.addTests(test_init_project.suite())
suite.addTests(test_commit.suite())
suite.addTests(test_repairwc.suite())
suite.addTests(test_package_status.suite())
suite.addTests(test_project_status.suite())
suite.addTests(test_request.suite())
suite.addTests(test_setlinkrev.suite())
suite.addTests(test_prdiff.suite())
suite.addTests(test_results.suite())
suite.addTests(test_helpers.suite())
if have_xmlrunner:
result = xmlrunner.XMLTestRunner(output=os.path.join(os.getcwd(), 'junit-xml-results')).run(suite)
else:
result = unittest.TextTestRunner(verbosity=1).run(suite)
sys.exit(not result.wasSuccessful())

View File

@ -2,9 +2,9 @@ import osc.core
import osc.oscerr
import os
import sys
from common import OscTestCase
from .common import OscTestCase
FIXTURES_DIR = os.path.join(os.getcwd(), 'addfile_fixtures')
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'addfile_fixtures')
def suite():
import unittest

View File

@ -2,7 +2,7 @@ import osc.core
import osc.oscerr
import os
import sys
from common import GET, PUT, POST, DELETE, OscTestCase
from .common import GET, PUT, POST, DELETE, OscTestCase
try:
# Works up to Python 3.8, needed for Python < 3.3 (inc 2.7)
from xml.etree import cElementTree as ET
@ -16,7 +16,7 @@ except ImportError:
#python 2.x
from urllib2 import HTTPError
FIXTURES_DIR = os.path.join(os.getcwd(), 'commit_fixtures')
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'commit_fixtures')
def suite():
import unittest

View File

@ -1,9 +1,9 @@
import osc.core
import osc.oscerr
import os
from common import OscTestCase
from .common import OscTestCase
FIXTURES_DIR = os.path.join(os.getcwd(), 'deletefile_fixtures')
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'deletefile_fixtures')
def suite():
import unittest

View File

@ -3,9 +3,9 @@ import osc.oscerr
from osc.util.helper import decode_list
import os
import re
from common import GET, OscTestCase
from .common import GET, OscTestCase
FIXTURES_DIR = os.path.join(os.getcwd(), 'difffile_fixtures')
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'difffile_fixtures')
def suite():
import unittest

View File

@ -1,8 +1,8 @@
import osc.core
import osc.oscerr
import os
from common import OscTestCase
FIXTURES_DIR = os.path.join(os.getcwd(), 'init_package_fixtures')
from .common import OscTestCase
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'init_package_fixtures')
def suite():
import unittest

View File

@ -1,8 +1,8 @@
import osc.core
import osc.oscerr
import os
from common import GET, OscTestCase
FIXTURES_DIR = os.path.join(os.getcwd(), 'init_project_fixtures')
from .common import GET, OscTestCase
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'init_project_fixtures')
def suite():
import unittest

View File

@ -1,9 +1,9 @@
import osc.core
import osc.oscerr
import os
from common import OscTestCase
from .common import OscTestCase
FIXTURES_DIR = os.path.join(os.getcwd(), 'project_package_status_fixtures')
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'project_package_status_fixtures')
def suite():
import unittest

View File

@ -4,10 +4,10 @@ import osc.oscerr
import os
import re
import sys
from common import GET, POST, OscTestCase, addExpectedRequest, EXPECTED_REQUESTS
from .common import GET, POST, OscTestCase, addExpectedRequest, EXPECTED_REQUESTS
FIXTURES_DIR = os.path.join(os.getcwd(), 'prdiff_fixtures')
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'prdiff_fixtures')
API_URL = 'http://localhost/'
UPSTREAM = 'some:project'
BRANCH = 'home:user:branches:' + UPSTREAM

View File

@ -1,9 +1,9 @@
import osc.core
import osc.oscerr
import os
from common import OscTestCase
from .common import OscTestCase
FIXTURES_DIR = os.path.join(os.getcwd(), 'project_package_status_fixtures')
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'project_package_status_fixtures')
def suite():
import unittest

View File

@ -2,7 +2,7 @@ import osc.core
import osc.oscerr
import os
import sys
from common import GET, PUT, POST, DELETE, OscTestCase
from .common import GET, PUT, POST, DELETE, OscTestCase
try:
# Works up to Python 3.8, needed for Python < 3.3 (inc 2.7)
from xml.etree import cElementTree as ET
@ -10,7 +10,7 @@ except ImportError:
# will import a fast implementation from 3.3 onwards, needed
# for 3.9+
from xml.etree import ElementTree as ET
FIXTURES_DIR = os.path.join(os.getcwd(), 'repairwc_fixtures')
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'repairwc_fixtures')
def suite():
import unittest

View File

@ -9,9 +9,9 @@ except ImportError:
import osc.core
import osc.oscerr
import os
from common import OscTestCase
from .common import OscTestCase
FIXTURES_DIR = os.path.join(os.getcwd(), 'request_fixtures')
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'request_fixtures')
def suite():
import unittest

View File

@ -1,5 +1,5 @@
import osc.commandline
from common import GET, OscTestCase
from .common import GET, OscTestCase
import os
import sys

View File

@ -1,9 +1,9 @@
import osc.core
import osc.oscerr
import os
from common import OscTestCase
from .common import OscTestCase
FIXTURES_DIR = os.path.join(os.getcwd(), 'revertfile_fixtures')
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'revertfile_fixtures')
def suite():
import unittest

View File

@ -1,8 +1,8 @@
import osc.core
import osc.oscerr
import os
from common import GET, PUT, OscTestCase
FIXTURES_DIR = os.path.join(os.getcwd(), 'setlinkrev_fixtures')
from .common import GET, PUT, OscTestCase
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'setlinkrev_fixtures')
def suite():
import unittest

View File

@ -2,8 +2,8 @@ import osc.core
import osc.oscerr
import os
import sys
from common import GET, OscTestCase
FIXTURES_DIR = os.path.join(os.getcwd(), 'update_fixtures')
from .common import GET, OscTestCase
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'update_fixtures')
def suite():
import unittest