Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.
/ pulp Public archive

Commit

Permalink
PEP-8 pulp.devel.
Browse files Browse the repository at this point in the history
  • Loading branch information
Randy Barlow committed Jun 16, 2015
1 parent f4cf977 commit 06074e6
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 90 deletions.
14 changes: 0 additions & 14 deletions devel/pulp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,2 @@
# -*- coding: utf-8 -*-
#
# Copyright © 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied warranties of MERCHANTABILITY,
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
# have received a copy of GPLv2 along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

66 changes: 18 additions & 48 deletions devel/pulp/devel/mock_handlers.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,19 @@
#!/usr/bin/python
#
# Copyright (c) 2011 Red Hat, Inc.
#
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied warranties of MERCHANTABILITY,
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
# have received a copy of GPLv2 along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

#
# Contains mock agent content handlers.
#
"""
Contains mock agent content handlers.
"""

import os
import shutil

from pulp.agent.lib.report import *
import sys


PACKAGE = 'test.handlers'

#
# Handlers to be deployed for loader testing
#

# -- Mock RPM Handler --------------------------------------------------------------------

# Handlers to be deployed for loader testing
RPM = dict(
name='rpm',
descriptor="""
name='rpm',
descriptor="""
[main]
enabled=1
Expand All @@ -52,8 +33,7 @@
[Linux]
class=LinuxHandler
""",
handler=
"""
handler="""
from pulp.agent.lib.handler import *
from pulp.agent.lib.report import *
from pulp.agent.lib.conduit import *
Expand Down Expand Up @@ -127,12 +107,10 @@ def reboot(self, conduit, options):
""")


# -- Mock SRPM Handler -------------------------------------------------------------------
# note: loading into site-packages

SRPM = dict(
name='srpm',
descriptor="""
name='srpm',
descriptor="""
[main]
enabled=1
Expand All @@ -143,8 +121,7 @@ def reboot(self, conduit, options):
class=%s.srpm.SRpmHandler
""" % PACKAGE,
handler=
"""
handler="""
from pulp.agent.lib.handler import *
from pulp.agent.lib.report import *
from pulp.agent.lib.conduit import *
Expand Down Expand Up @@ -175,26 +152,23 @@ def uninstall(self, conduit, units, options):
report.succeeded({}, len(units))
return report
""",
site_packages=True)
site_packages=True)

# -- Mock (section missing) Handler ------------------------------------------------------

SECTION_MISSING = dict(
name='Test-section-not-found',
descriptor="""
name='Test-section-not-found',
descriptor="""
[main]
enabled=1
[types]
content=puppet
""",
handler="""
handler="""
class A: pass
""")


# -- Mock (class not defined) Handler ----------------------------------------------------

NO_MODULE = dict(
name='Test-class-property-missing',
descriptor="""
Expand All @@ -205,15 +179,14 @@ class A: pass
[puppet]
foo=bar
""",
handler="""
handler="""
class A: pass
""")

# -- Mock (class not found) Handler ----------------------------------------------------

CLASS_NDEF = dict(
name='Test-class-not-found',
descriptor="""
name='Test-class-not-found',
descriptor="""
[main]
enabled=1
[types]
Expand All @@ -222,9 +195,6 @@ class A: pass
class=Something
""")

#
# Mock Deployer
#

class MockDeployer:

Expand Down
5 changes: 2 additions & 3 deletions devel/pulp/devel/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
pulp_puppet
"""

import copy
import argparse
import subprocess
import sys
import argparse


def run_tests(packages, tests_all_platforms, tests_non_rhel5,
Expand All @@ -26,7 +25,7 @@ def run_tests(packages, tests_all_platforms, tests_non_rhel5,
:type tests_non_rhel5: list of str
:param flake8_paths: paths that should be checked with flake8
:type flake8_paths: list of str
:return: the exit code from nosetests
:return: the exit code from nosetests
:rtype: integer
"""
parser = argparse.ArgumentParser()
Expand Down
4 changes: 2 additions & 2 deletions devel/pulp/devel/unit/util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
import mock
import os


def compare_dict(source, target):
Expand All @@ -17,7 +17,7 @@ def compare_dict(source, target):
if not isinstance(target, dict):
raise AssertionError("Target is not a dictionary")

#test keys
# test keys
source_keys = set(source.keys())
target_keys = set(target.keys())

Expand Down
15 changes: 1 addition & 14 deletions devel/test/unit/test_util.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied warranties of MERCHANTABILITY,
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
# have received a copy of GPLv2 along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

import unittest
import os
import unittest
import shutil
import tempfile

Expand Down Expand Up @@ -115,4 +103,3 @@ def test_side_effect(self):
# and use the return_value instead of the object itself.
self.assertEquals(side_effect().foo, 'bar')
self.assertEquals(side_effect().foo, 'qux')

10 changes: 1 addition & 9 deletions run-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,7 @@
'bindings',
'client_consumer',
'client_lib',
'devel/pulp/devel/dummy_plugins.py',
'devel/pulp/devel/mock_cursor.py',
'devel/pulp/devel/mock_distributor.py',
'devel/pulp/devel/mock_plugins.py',
'devel/pulp/devel/unit/base.py',
'devel/pulp/devel/unit/server/',
'devel/pulp/devel/unit/task_simulator.py',
'devel/setup.py',
'devel/test/unit/test_task_simulator.py',
'devel/',
'oid_validation/',
'repoauth/',
'server/pulp/plugins',
Expand Down

0 comments on commit 06074e6

Please sign in to comment.