Skip to content

Commit f3158e1

Browse files
committed
fix: multiple paths and tests
1 parent f5442e9 commit f3158e1

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

test_xenon.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ def __getattr__(self, attr):
2020

2121

2222
class Arguments(object):
23-
path = 'xenon'
23+
path = ['xenon']
2424
url = 'http://api.barium.cc/jobs'
2525
repo_token = 'abcdef1234569abdcef'
2626
service_job_id = '4699301'
2727
service_name = 'travis-ci',
28-
config = os.path.join(path, '.xenon.yml')
28+
config = os.path.join(path[0], '.xenon.yml')
2929
exclude = None
3030
ignore = None
3131
no_assert = False
@@ -73,7 +73,7 @@ def testCheck(self):
7373
@parametrized(
7474
# results
7575
# absolute, average, modules, averagenum
76-
# exit code
76+
# infractions
7777
(
7878
{'mod.py': [4, 12, 8, 9], 'mod2.py': [3, 3, 2, 10]},
7979
('C', 'B', 'B', None),
@@ -112,23 +112,23 @@ def testCheck(self):
112112
(
113113
{'mod.py': [4, 12, 8, 9], 'mod2.py': [3, 3, 2, 10]},
114114
(None, None, None, 0),
115-
0
115+
1
116116
),
117117
)
118-
class RunTestCase(unittest.TestCase):
118+
class InfractionsTestCase(unittest.TestCase):
119119

120-
def setParameters(self, results, args, exit_code):
120+
def setParameters(self, results, args, infractions):
121121
r = {}
122122
for k, v in results.items():
123123
r[k] = [dict(name='block', complexity=cc, lineno=1) for cc in v]
124124
self.r = r
125125
self.args = Args(*args)
126126
self.logger = CatchAll()
127-
self.exit_code = exit_code
127+
self.infractions = infractions
128128

129129
def test_run(self):
130-
code = core.find_infractions(self.args, self.logger, self.r)
131-
self.assertEqual(code != 0, self.exit_code)
130+
infr = core.find_infractions(self.args, self.logger, self.r)
131+
self.assertEqual(infr, self.infractions)
132132

133133

134134
class APITestCase(unittest.TestCase):

xenon/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def main(args=None):
9090
repo_token=args.repo_token,
9191
service_job_id=args.service_job_id,
9292
service_name=args.service_name,
93-
git=gitrepo(args.path),
93+
git=gitrepo(args.path[0]),
9494
cc_data=cc_data
9595
)
9696
logger.info('HTTP: %s', response.status_code)

xenon/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def analyze(args, logger):
1212
given *logger*.
1313
The *args* object should have the following attributes:
1414
15-
* ``path``: the file to analyze.
15+
* ``path``: a list of files to analyze.
1616
* ``exclude`` and ``ignore``: the patterns specifying which files to
1717
exclude and which directories to ignore.
1818
* ``no_assert``: if ``True``, ``assert`` statements will not be counted

0 commit comments

Comments
 (0)