Skip to content

Commit

Permalink
Fix flake
Browse files Browse the repository at this point in the history
Fix coverage hopefully
  • Loading branch information
hipek8 committed Dec 13, 2024
1 parent 712124a commit 9b154c7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ requires = ["setuptools<66.0"]
build-backend = "setuptools.build_meta"

[tools.coverage.run]
sources = ralph
branch = 1

[tools.coverage.report]
Expand Down
6 changes: 3 additions & 3 deletions src/ralph/dhcp/agent/dhcp_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
from urllib.request import Request, urlopen
string_types = (str,)
except: # noqa
from urllib import urlencode
from urllib2 import HTTPError, Request, urlopen
string_types = (basestring,)
from urllib import urlencode # noqa
from urllib2 import HTTPError, Request, urlopen # noqa
string_types = (basestring,) # noqa


APP_DIR = os.path.expanduser('~/.ralph-dhcp-agent')
Expand Down
10 changes: 7 additions & 3 deletions src/ralph/dhcp/agent/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
import unittest
from optparse import Values

from mock import MagicMock, Mock, patch

from ralph.dhcp.agent.dhcp_agent import (
Cache,
DHCPConfigManager,
_check_params,
_get_cmd_params_from_parser,
Cache,
DHCPConfigManager
)
from mock import MagicMock, Mock, patch

logger = logging.getLogger(__file__)
mocked_parser = MagicMock()
Expand All @@ -23,8 +24,11 @@ def mocked_read(self):
}
return type('response', (object,), attrs)


def mocked_error(msg):
raise Exception(msg)


mocked_parser.error = mocked_error

default_params = {
Expand Down
2 changes: 1 addition & 1 deletion src/ralph/dhcp/tests/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from django.contrib.auth import get_user_model
from django.test import LiveServerTestCase

from ralph.dhcp.agent.dhcp_agent import Cache, DHCPConfigManager
from ralph.data_center.tests.factories import DataCenterFactory
from ralph.dhcp.agent.dhcp_agent import Cache, DHCPConfigManager
from ralph.dhcp.models import DHCPServer

logger = logging.getLogger(__file__)
Expand Down
2 changes: 0 additions & 2 deletions src/ralph/settings/test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import sys

from ralph.settings import * # noqa

DEBUG = False
Expand Down

0 comments on commit 9b154c7

Please sign in to comment.