Skip to content

Commit

Permalink
Move imports to the top of modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomprince committed Jun 21, 2016
1 parent 410605a commit 832792a
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 18 deletions.
3 changes: 1 addition & 2 deletions common/flake8rc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ max-line-length = 100
# E721 do not compare types, use 'isinstance()'
# W503 line break before binary operator
# E731 do not assign a lambda expression, use a def
# E402 module level import not at top of file

ignore = E122,E123,E126,E128,E211,E501,E711,E712,E721,E731,W503,E402
ignore = E122,E123,E126,E128,E211,E501,E711,E712,E721,E731,W503
7 changes: 3 additions & 4 deletions master/buildbot/buildslave/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@
# This module is left for backward compatibility of old-named worker API.
# It should never be imported by Buildbot.

from buildbot.worker import AbstractLatentWorker as _AbstractLatentWorker
from buildbot.worker import AbstractWorker as _AbstractWorker
from buildbot.worker import Worker as _Worker
from buildbot.worker_transition import deprecatedWorkerModuleAttribute
from buildbot.worker_transition import reportDeprecatedWorkerModuleUsage

reportDeprecatedWorkerModuleUsage(
"'{old}' module is deprecated, use "
"'buildbot.worker' module instead".format(old=__name__))

from buildbot.worker import AbstractLatentWorker as _AbstractLatentWorker
from buildbot.worker import AbstractWorker as _AbstractWorker
from buildbot.worker import Worker as _Worker

deprecatedWorkerModuleAttribute(locals(), _AbstractWorker,
compat_name="AbstractBuildSlave",
new_name="AbstractWorker")
Expand Down
14 changes: 8 additions & 6 deletions master/buildbot/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@
#
# Copyright Buildbot Team Members

import sys
import warnings

from distutils.version import LooseVersion

# apply the same patches the buildmaster does when it starts
from buildbot import monkeypatches

# apply the same patches the buildmaster does when it starts
monkeypatches.patch_all(for_tests=True)

# enable deprecation warnings
import warnings
warnings.filterwarnings('always', category=DeprecationWarning)

import sys
if sys.version_info[:2] < (3, 2):
# Setup logging unhandled messages to stderr.
# Since Python 3.2 similar functionality implemented through
Expand Down Expand Up @@ -65,9 +67,9 @@
# were emitted.
# Without explicit load of deprecated modules it's hard to predict when
# they will be imported and when warning should be catched.
from buildbot.test.util.warnings import assertProducesWarning
from buildbot.worker_transition import DeprecatedWorkerAPIWarning
from buildbot.worker_transition import DeprecatedWorkerModuleWarning
from buildbot.test.util.warnings import assertProducesWarning # noqa
from buildbot.worker_transition import DeprecatedWorkerAPIWarning # noqa
from buildbot.worker_transition import DeprecatedWorkerModuleWarning # noqa

with assertProducesWarning(
DeprecatedWorkerModuleWarning,
Expand Down
3 changes: 1 addition & 2 deletions master/buildbot/test/test_extra_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
# included in the coverage because none of the tests import
# them; this results in a more accurate total coverage percent.

modules = [] # for the benefit of pyflakes

from buildbot import worker
from buildbot.changes import p4poller
from buildbot.changes import svnpoller
Expand All @@ -43,6 +41,7 @@
from buildbot.steps.package.rpm import rpmspec
from buildbot.util import eventual

modules = [] # for the benefit of pyflakes
modules.extend([worker])
modules.extend([p4poller, svnpoller])
modules.extend([base, sendchange, tryclient])
Expand Down
3 changes: 1 addition & 2 deletions slave/buildslave/test/test_extra_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
# included in the coverage because none of the tests import
# them; this results in a more accurate total coverage percent.

modules = [] # for the benefit of pyflakes

from buildslave.scripts import logwatcher

modules = [] # for the benefit of pyflakes
modules.extend([logwatcher])
3 changes: 1 addition & 2 deletions worker/buildbot_worker/test/test_extra_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
# included in the coverage because none of the tests import
# them; this results in a more accurate total coverage percent.

modules = [] # for the benefit of pyflakes

from buildbot_worker.scripts import logwatcher

modules = [] # for the benefit of pyflakes
modules.extend([logwatcher])

0 comments on commit 832792a

Please sign in to comment.