-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for path split and regression for old path behavior
Mock argv before calling ProspectorConfig in tests
- Loading branch information
Showing
7 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# -*- coding: utf-8 -*- | ||
import os | ||
import sys | ||
from unittest import TestCase | ||
|
||
from prospector.config import ProspectorConfig | ||
from prospector.finder import find_python | ||
from prospector.tools.pylint import PylintTool | ||
|
||
if sys.version_info >= (3, 0): | ||
from unittest.mock import patch | ||
else: | ||
from mock import patch | ||
|
||
|
||
class TestPylintTool(TestCase): | ||
def setUp(self): | ||
with patch('sys.argv', ['']): | ||
self.config = ProspectorConfig() | ||
self.pylint_tool = PylintTool() | ||
|
||
def test_absolute_path_is_computed_correctly(self): | ||
root = os.path.join(os.path.dirname(__file__), 'testpath', 'test.py') | ||
root_sep_split = root.split(os.path.sep) | ||
root_os_split = os.path.split(root) | ||
found_files = find_python([], [root], explicit_file_mode=True) | ||
self.pylint_tool.configure(self.config, found_files) | ||
self.assertNotEqual(self.pylint_tool._args, | ||
[os.path.join(*root_sep_split)]) | ||
self.assertEqual(self.pylint_tool._args, | ||
[os.path.join(*root_os_split)]) |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ skip_missing_interpreters = true | |
[testenv] | ||
deps = | ||
nose | ||
py27: mock | ||
commands = nosetests tests |