Skip to content

Commit 8864bb0

Browse files
committed
refactor: module and package with same name is bad
1 parent 05507eb commit 8864bb0

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/auditor/cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from supervisor.models import MessageDetails, Supervisor
3030
from supervisor.message_handlers import SendGridHandler
3131

32-
from .auditor import Auditor, credentials
32+
from auditor.models import Auditor, credentials
3333

3434

3535
def cli():

src/auditor/auditor.py renamed to src/auditor/models.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
auditor.py
2+
models.py
33
44
See cli.py for usage
55
"""
@@ -14,7 +14,7 @@
1414
import arcgis
1515
import arcpy
1616

17-
from . import checks, fixes, credentials, org_checker
17+
from auditor import checks, fixes, credentials, org_checker
1818

1919

2020
def retry(worker, verbose=True, tries=1):

tests/test_auditor.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from collections import namedtuple
55

6-
from auditor.auditor import Auditor, retry, Metatable
6+
from auditor.models import Auditor, retry, Metatable
77

88

99
def test_retry():
@@ -29,7 +29,7 @@ def return_sgid_row(self, table, fields):
2929

3030
sgid_fields = ['TABLENAME', 'AGOL_ITEM_ID', 'AGOL_PUBLISHED_NAME', 'Authoritative']
3131

32-
mocker.patch('auditor.auditor.Metatable._cursor_wrapper', return_sgid_row)
32+
mocker.patch('auditor.models.Metatable._cursor_wrapper', return_sgid_row)
3333

3434
test_table = Metatable()
3535
test_table.read_metatable('something', sgid_fields)
@@ -47,7 +47,7 @@ def return_agol_row(self, table, fields):
4747

4848
agol_fields = ['TABLENAME', 'AGOL_ITEM_ID', 'AGOL_PUBLISHED_NAME', 'CATEGORY']
4949

50-
mocker.patch('auditor.auditor.Metatable._cursor_wrapper', return_agol_row)
50+
mocker.patch('auditor.models.Metatable._cursor_wrapper', return_agol_row)
5151

5252
test_table = Metatable()
5353
test_table.read_metatable('something', agol_fields)
@@ -64,7 +64,7 @@ def return_sgid_row(self, table, fields):
6464

6565
sgid_fields = ['TABLENAME', 'AGOL_ITEM_ID', 'AGOL_PUBLISHED_NAME', 'Authoritative']
6666

67-
mocker.patch('auditor.auditor.Metatable._cursor_wrapper', return_sgid_row)
67+
mocker.patch('auditor.models.Metatable._cursor_wrapper', return_sgid_row)
6868

6969
test_table = Metatable()
7070
test_table.read_metatable('something', sgid_fields)
@@ -82,7 +82,7 @@ def return_sgid_row(self, table, fields):
8282

8383
sgid_fields = ['TABLENAME', 'AGOL_ITEM_ID', 'AGOL_PUBLISHED_NAME', 'Authoritative']
8484

85-
mocker.patch('auditor.auditor.Metatable._cursor_wrapper', return_sgid_row)
85+
mocker.patch('auditor.models.Metatable._cursor_wrapper', return_sgid_row)
8686

8787
test_table = Metatable()
8888
test_table.read_metatable('something', sgid_fields)
@@ -101,7 +101,7 @@ def return_sgid_row(self, table, fields):
101101

102102
sgid_fields = ['TABLENAME', 'AGOL_ITEM_ID', 'AGOL_PUBLISHED_NAME', 'Authoritative']
103103

104-
mocker.patch('auditor.auditor.Metatable._cursor_wrapper', return_sgid_row)
104+
mocker.patch('auditor.models.Metatable._cursor_wrapper', return_sgid_row)
105105

106106
test_table = Metatable()
107107
test_table.read_metatable('something', sgid_fields)
@@ -128,12 +128,12 @@ def return_agol_row(self, table, fields):
128128
sgid_fields = ['TABLENAME', 'AGOL_ITEM_ID', 'AGOL_PUBLISHED_NAME', 'Authoritative']
129129
agol_fields = ['TABLENAME', 'AGOL_ITEM_ID', 'AGOL_PUBLISHED_NAME', 'CATEGORY']
130130

131-
mocker.patch('auditor.auditor.Metatable._cursor_wrapper', return_sgid_row)
131+
mocker.patch('auditor.models.Metatable._cursor_wrapper', return_sgid_row)
132132

133133
test_table = Metatable()
134134
test_table.read_metatable('something', sgid_fields)
135135

136-
mocker.patch('auditor.auditor.Metatable._cursor_wrapper', return_agol_row)
136+
mocker.patch('auditor.models.Metatable._cursor_wrapper', return_agol_row)
137137
test_table.read_metatable('agol something', agol_fields)
138138

139139
#: Our duplicate id should be the only entry in .duplicate_keys and .metatable_dict should just have first item
@@ -150,7 +150,7 @@ def test_org_checker_completes_and_logs(mocker, caplog):
150150
agol_item = namedtuple('agol_item', ['title', 'itemid'])
151151
item_list = [agol_item('foo', 1), agol_item('foo', 2)]
152152

153-
mocker.patch('auditor.auditor.Auditor.setup')
153+
mocker.patch('auditor.models.Auditor.setup')
154154

155155
test_auditor = Auditor(cli_logger, verbose=True)
156156
test_auditor.items_to_check = item_list
@@ -168,7 +168,7 @@ def test_org_checker_reports_no_results(mocker, caplog):
168168
agol_item = namedtuple('agol_item', ['title', 'itemid'])
169169
item_list = [agol_item('foo', 1), agol_item('bar', 2)]
170170

171-
mocker.patch('auditor.auditor.Auditor.setup')
171+
mocker.patch('auditor.models.Auditor.setup')
172172

173173
test_auditor = Auditor(cli_logger, verbose=True)
174174
test_auditor.items_to_check = item_list

tests/test_checks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from auditor import credentials
99
from auditor import checks
10-
from auditor.auditor import Auditor
10+
from auditor.models import Auditor
1111

1212
# @pytest.fixture
1313
# def agol_item():

0 commit comments

Comments
 (0)