Fix imports, python3 doesn't import from .
This commit is contained in:
parent
691fa83616
commit
c11313b2dc
@ -1,5 +1,5 @@
|
|||||||
import logging
|
import logging
|
||||||
from OBSLocal import OBSLocalTestCase
|
from . import OBSLocal
|
||||||
from osclib.comments import CommentAPI
|
from osclib.comments import CommentAPI
|
||||||
from ReviewBot import ReviewBot
|
from ReviewBot import ReviewBot
|
||||||
import random
|
import random
|
||||||
@ -8,7 +8,7 @@ import random
|
|||||||
COMMENT = 'short comment'
|
COMMENT = 'short comment'
|
||||||
PROJECT = 'openSUSE:Factory:Staging'
|
PROJECT = 'openSUSE:Factory:Staging'
|
||||||
|
|
||||||
class TestReviewBotComment(OBSLocalTestCase):
|
class TestReviewBotComment(OBSLocal.OBSLocalTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestReviewBotComment, self).setUp()
|
super(TestReviewBotComment, self).setUp()
|
||||||
self.api = CommentAPI(self.apiurl)
|
self.api = CommentAPI(self.apiurl)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from obs import APIURL
|
from . import obs
|
||||||
from obs import OBS
|
|
||||||
from osclib.accept_command import AcceptCommand
|
from osclib.accept_command import AcceptCommand
|
||||||
from osclib.conf import Config
|
from osclib.conf import Config
|
||||||
from osclib.comments import CommentAPI
|
from osclib.comments import CommentAPI
|
||||||
@ -14,9 +13,9 @@ class TestAccept(unittest.TestCase):
|
|||||||
"""
|
"""
|
||||||
Initialize the configuration
|
Initialize the configuration
|
||||||
"""
|
"""
|
||||||
self.obs = OBS()
|
self.obs = obs.OBS()
|
||||||
Config(APIURL, 'openSUSE:Factory')
|
Config(obs.APIURL, 'openSUSE:Factory')
|
||||||
self.api = StagingAPI(APIURL, 'openSUSE:Factory')
|
self.api = StagingAPI(obs.APIURL, 'openSUSE:Factory')
|
||||||
|
|
||||||
def test_accept_comments(self):
|
def test_accept_comments(self):
|
||||||
c_api = CommentAPI(self.api.apiurl)
|
c_api = CommentAPI(self.api.apiurl)
|
||||||
|
@ -2,8 +2,7 @@ import sys
|
|||||||
import unittest
|
import unittest
|
||||||
import httpretty
|
import httpretty
|
||||||
|
|
||||||
from obs import APIURL
|
from . import obs
|
||||||
from obs import OBS
|
|
||||||
from osclib.conf import Config
|
from osclib.conf import Config
|
||||||
from osclib.stagingapi import StagingAPI
|
from osclib.stagingapi import StagingAPI
|
||||||
|
|
||||||
@ -17,9 +16,9 @@ class TestApiCalls(unittest.TestCase):
|
|||||||
Initialize the configuration
|
Initialize the configuration
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.obs = OBS()
|
self.obs = obs.OBS()
|
||||||
Config(APIURL, 'openSUSE:Factory')
|
Config(obs.APIURL, 'openSUSE:Factory')
|
||||||
self.api = StagingAPI(APIURL, 'openSUSE:Factory')
|
self.api = StagingAPI(obs.APIURL, 'openSUSE:Factory')
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
"""Clean internal cache"""
|
"""Clean internal cache"""
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from obs import APIURL
|
from . import obs
|
||||||
from obs import OBS
|
|
||||||
from osclib.conf import Config
|
from osclib.conf import Config
|
||||||
from osclib.check_command import CheckCommand
|
from osclib.check_command import CheckCommand
|
||||||
from osclib.stagingapi import StagingAPI
|
from osclib.stagingapi import StagingAPI
|
||||||
@ -113,9 +112,9 @@ class TestCheckCommand(unittest.TestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""Initialize the configuration."""
|
"""Initialize the configuration."""
|
||||||
|
|
||||||
self.obs = OBS()
|
self.obs = obs.OBS()
|
||||||
Config(APIURL, 'openSUSE:Factory')
|
Config(obs.APIURL, 'openSUSE:Factory')
|
||||||
self.stagingapi = StagingAPI(APIURL, 'openSUSE:Factory')
|
self.stagingapi = StagingAPI(obs.APIURL, 'openSUSE:Factory')
|
||||||
self.checkcommand = CheckCommand(self.stagingapi)
|
self.checkcommand = CheckCommand(self.stagingapi)
|
||||||
|
|
||||||
def test_check_command_all(self):
|
def test_check_command_all(self):
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from OBSLocal import OBSLocalTestCase
|
from . import OBSLocal
|
||||||
from osclib.comments import CommentAPI
|
from osclib.comments import CommentAPI
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
@ -90,7 +90,7 @@ handle
|
|||||||
self.assertEqual(info, COMMENT_INFO)
|
self.assertEqual(info, COMMENT_INFO)
|
||||||
|
|
||||||
|
|
||||||
class TestCommentOBS(OBSLocalTestCase):
|
class TestCommentOBS(OBSLocal.OBSLocalTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestCommentOBS, self).setUp()
|
super(TestCommentOBS, self).setUp()
|
||||||
self.api = CommentAPI(self.apiurl)
|
self.api = CommentAPI(self.apiurl)
|
||||||
|
@ -6,36 +6,34 @@ from osclib.core import attribute_value_save
|
|||||||
from osclib.memoize import memoize_session_reset
|
from osclib.memoize import memoize_session_reset
|
||||||
from osclib.stagingapi import StagingAPI
|
from osclib.stagingapi import StagingAPI
|
||||||
|
|
||||||
from obs import APIURL
|
from . import obs
|
||||||
from obs import PROJECT
|
|
||||||
from obs import OBS
|
|
||||||
|
|
||||||
|
|
||||||
class TestConfig(unittest.TestCase):
|
class TestConfig(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.obs = OBS()
|
self.obs = obs.OBS()
|
||||||
self.load_config()
|
self.load_config()
|
||||||
self.api = StagingAPI(APIURL, PROJECT)
|
self.api = StagingAPI(obs.APIURL, obs.PROJECT)
|
||||||
|
|
||||||
def load_config(self, project=PROJECT):
|
def load_config(self, project=obs.PROJECT):
|
||||||
self.config = Config(APIURL, project)
|
self.config = Config(obs.APIURL, project)
|
||||||
|
|
||||||
def test_basic(self):
|
def test_basic(self):
|
||||||
self.assertEqual('openSUSE', conf.config[PROJECT]['lock-ns'])
|
self.assertEqual('openSUSE', conf.config[obs.PROJECT]['lock-ns'])
|
||||||
|
|
||||||
def test_remote(self):
|
def test_remote(self):
|
||||||
# Initial config present in fixtures/oscrc and obs.py attribute default.
|
# Initial config present in fixtures/oscrc and obs.py attribute default.
|
||||||
# Local config fixture contains overridden-by-local and should win over
|
# Local config fixture contains overridden-by-local and should win over
|
||||||
# the remote config value.
|
# the remote config value.
|
||||||
self.assertEqual('local', conf.config[PROJECT]['overridden-by-local'])
|
self.assertEqual('local', conf.config[obs.PROJECT]['overridden-by-local'])
|
||||||
self.assertEqual('remote-indeed', conf.config[PROJECT]['remote-only'])
|
self.assertEqual('remote-indeed', conf.config[obs.PROJECT]['remote-only'])
|
||||||
|
|
||||||
# Change remote value.
|
# Change remote value.
|
||||||
attribute_value_save(APIURL, PROJECT, 'Config', 'remote-only = new value\n')
|
attribute_value_save(obs.APIURL, obs.PROJECT, 'Config', 'remote-only = new value\n')
|
||||||
self.load_config()
|
self.load_config()
|
||||||
|
|
||||||
self.assertEqual('local', conf.config[PROJECT]['overridden-by-local'])
|
self.assertEqual('local', conf.config[obs.PROJECT]['overridden-by-local'])
|
||||||
self.assertEqual('new value', conf.config[PROJECT]['remote-only'])
|
self.assertEqual('new value', conf.config[obs.PROJECT]['remote-only'])
|
||||||
|
|
||||||
def test_remote_none(self):
|
def test_remote_none(self):
|
||||||
self.load_config('not_real_project')
|
self.load_config('not_real_project')
|
||||||
@ -63,16 +61,16 @@ class TestConfig(unittest.TestCase):
|
|||||||
# Ensure each pattern is match instead of catch-all pattern.
|
# Ensure each pattern is match instead of catch-all pattern.
|
||||||
patterns = set()
|
patterns = set()
|
||||||
for project in projects:
|
for project in projects:
|
||||||
config = Config(APIURL, project)
|
config = Config(obs.APIURL, project)
|
||||||
patterns.add(conf.config[project]['pattern'])
|
patterns.add(conf.config[project]['pattern'])
|
||||||
|
|
||||||
self.assertEqual(len(patterns), len(DEFAULT))
|
self.assertEqual(len(patterns), len(DEFAULT))
|
||||||
|
|
||||||
def test_get_memoize_reset(self):
|
def test_get_memoize_reset(self):
|
||||||
"""Ensure memoize_session_reset() properly forces re-fetch of config."""
|
"""Ensure memoize_session_reset() properly forces re-fetch of config."""
|
||||||
self.assertEqual('remote-indeed', Config.get(APIURL, PROJECT)['remote-only'])
|
self.assertEqual('remote-indeed', Config.get(obs.APIURL, obs.PROJECT)['remote-only'])
|
||||||
|
|
||||||
attribute_value_save(APIURL, PROJECT, 'Config', 'remote-only = new value\n')
|
attribute_value_save(obs.APIURL, obs.PROJECT, 'Config', 'remote-only = new value\n')
|
||||||
memoize_session_reset()
|
memoize_session_reset()
|
||||||
|
|
||||||
self.assertEqual('new value', Config.get(APIURL, PROJECT)['remote-only'])
|
self.assertEqual('new value', Config.get(obs.APIURL, obs.PROJECT)['remote-only'])
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
from OBSLocal import OBSLocalTestCase
|
from . import OBSLocal
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
class TestDevelProject(OBSLocalTestCase):
|
class TestDevelProject(OBSLocal.OBSLocalTestCase):
|
||||||
script = './devel-project.py'
|
script = './devel-project.py'
|
||||||
script_debug_osc = False
|
script_debug_osc = False
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@ import difflib
|
|||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from obs import APIURL
|
from . import obs
|
||||||
from obs import OBS
|
|
||||||
from osclib.conf import Config
|
from osclib.conf import Config
|
||||||
from osclib.freeze_command import FreezeCommand
|
from osclib.freeze_command import FreezeCommand
|
||||||
from osclib.stagingapi import StagingAPI
|
from osclib.stagingapi import StagingAPI
|
||||||
@ -16,9 +16,9 @@ class TestFreeze(unittest.TestCase):
|
|||||||
"""
|
"""
|
||||||
Initialize the configuration
|
Initialize the configuration
|
||||||
"""
|
"""
|
||||||
self.obs = OBS()
|
self.obs = obs.OBS()
|
||||||
Config(APIURL, 'openSUSE:Factory')
|
Config(obs.APIURL, 'openSUSE:Factory')
|
||||||
self.api = StagingAPI(APIURL, 'openSUSE:Factory')
|
self.api = StagingAPI(obs.APIURL, 'openSUSE:Factory')
|
||||||
|
|
||||||
def _get_fixture_path(self, filename):
|
def _get_fixture_path(self, filename):
|
||||||
"""
|
"""
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
from OBSLocal import OBSLocalTestCase
|
from . import OBSLocal
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
class TestMetrics(OBSLocalTestCase):
|
class TestMetrics(OBSLocal.OBSLocalTestCase):
|
||||||
script = './metrics.py'
|
script = './metrics.py'
|
||||||
script_debug_osc = False
|
script_debug_osc = False
|
||||||
|
|
||||||
|
@ -3,18 +3,15 @@ import unittest
|
|||||||
from osclib.conf import Config
|
from osclib.conf import Config
|
||||||
from osclib.obslock import OBSLock
|
from osclib.obslock import OBSLock
|
||||||
|
|
||||||
from obs import APIURL
|
from . import obs
|
||||||
from obs import PROJECT
|
|
||||||
from obs import OBS
|
|
||||||
|
|
||||||
|
|
||||||
class TestOBSLock(unittest.TestCase):
|
class TestOBSLock(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.obs = OBS()
|
self.obs = obs.OBS()
|
||||||
Config(APIURL, PROJECT)
|
Config(obs.APIURL, obs.PROJECT)
|
||||||
|
|
||||||
def obs_lock(self, reason='list'):
|
def obs_lock(self, reason='list'):
|
||||||
return OBSLock(APIURL, PROJECT, reason=reason)
|
return OBSLock(obs.APIURL, obs.PROJECT, reason=reason)
|
||||||
|
|
||||||
def assertLockFail(self, lock):
|
def assertLockFail(self, lock):
|
||||||
with self.assertRaises(SystemExit):
|
with self.assertRaises(SystemExit):
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from obs import APIURL
|
from . import obs
|
||||||
from obs import OBS
|
|
||||||
from osc import oscerr
|
from osc import oscerr
|
||||||
from osclib.comments import CommentAPI
|
from osclib.comments import CommentAPI
|
||||||
from osclib.conf import Config
|
from osclib.conf import Config
|
||||||
@ -15,9 +14,9 @@ class TestSelect(unittest.TestCase):
|
|||||||
"""
|
"""
|
||||||
Initialize the configuration
|
Initialize the configuration
|
||||||
"""
|
"""
|
||||||
self.obs = OBS()
|
self.obs = obs.OBS()
|
||||||
Config(APIURL, 'openSUSE:Factory')
|
Config(obs.APIURL, 'openSUSE:Factory')
|
||||||
self.api = StagingAPI(APIURL, 'openSUSE:Factory')
|
self.api = StagingAPI(obs.APIURL, 'openSUSE:Factory')
|
||||||
|
|
||||||
def test_old_frozen(self):
|
def test_old_frozen(self):
|
||||||
self.assertEqual(self.api.prj_frozen_enough('openSUSE:Factory:Staging:A'), False)
|
self.assertEqual(self.api.prj_frozen_enough('openSUSE:Factory:Staging:A'), False)
|
||||||
|
@ -3,16 +3,13 @@ from osclib.conf import Config
|
|||||||
from osclib.stagingapi import StagingAPI
|
from osclib.stagingapi import StagingAPI
|
||||||
from osclib.unselect_command import UnselectCommand
|
from osclib.unselect_command import UnselectCommand
|
||||||
|
|
||||||
from obs import APIURL
|
from . import obs
|
||||||
from obs import PROJECT
|
|
||||||
from obs import OBS
|
|
||||||
|
|
||||||
|
|
||||||
class TestUnselect(unittest.TestCase):
|
class TestUnselect(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.obs = OBS()
|
self.obs = obs.OBS()
|
||||||
Config(APIURL, PROJECT)
|
Config(obs.APIURL, obs.PROJECT)
|
||||||
self.api = StagingAPI(APIURL, PROJECT)
|
self.api = StagingAPI(obs.APIURL, obs.PROJECT)
|
||||||
|
|
||||||
def test_cleanup_filter(self):
|
def test_cleanup_filter(self):
|
||||||
UnselectCommand.config_init(self.api)
|
UnselectCommand.config_init(self.api)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user