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