summaryrefslogtreecommitdiffstats
path: root/tests/commands/run_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/commands/run_test.py')
-rw-r--r--tests/commands/run_test.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/commands/run_test.py b/tests/commands/run_test.py
index 00b4712..914d567 100644
--- a/tests/commands/run_test.py
+++ b/tests/commands/run_test.py
@@ -219,6 +219,19 @@ def test_types_hook_repository(cap_out, store, tempdir_factory):
assert b'bar.notpy' not in printed
+def test_types_or_hook_repository(cap_out, store, tempdir_factory):
+ git_path = make_consuming_repo(tempdir_factory, 'types_or_repo')
+ with cwd(git_path):
+ stage_a_file('bar.notpy')
+ stage_a_file('bar.pxd')
+ stage_a_file('bar.py')
+ ret, printed = _do_run(cap_out, store, git_path, run_opts())
+ assert ret == 1
+ assert b'bar.notpy' not in printed
+ assert b'bar.pxd' in printed
+ assert b'bar.py' in printed
+
+
def test_exclude_types_hook_repository(cap_out, store, tempdir_factory):
git_path = make_consuming_repo(tempdir_factory, 'exclude_types_repo')
with cwd(git_path):
@@ -951,6 +964,27 @@ def test_classifier_does_not_normalize_backslashes_non_windows(tmpdir):
assert classifier.filenames == [r'a/b\c']
+def test_classifier_empty_types_or(tmpdir):
+ tmpdir.join('bar').ensure()
+ os.symlink(tmpdir.join('bar'), tmpdir.join('foo'))
+ with tmpdir.as_cwd():
+ classifier = Classifier(('foo', 'bar'))
+ for_symlink = classifier.by_types(
+ classifier.filenames,
+ types=['symlink'],
+ types_or=[],
+ exclude_types=[],
+ )
+ for_file = classifier.by_types(
+ classifier.filenames,
+ types=['file'],
+ types_or=[],
+ exclude_types=[],
+ )
+ assert for_symlink == ['foo']
+ assert for_file == ['bar']
+
+
@pytest.fixture
def some_filenames():
return (