This repository was archived by the owner on Nov 3, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1489,3 +1489,25 @@ def test_comment_with_noqa_plus_docstring_file(env):
1489
1489
out , _ , code = env .invoke ()
1490
1490
assert '' == out
1491
1491
assert code == 0
1492
+
1493
+
1494
+ def test_match_considers_basenames_for_path_args (env ):
1495
+ """Test that `match` option only considers basenames for path arguments.
1496
+
1497
+ The test environment consists of a single empty module `test_a.py`. The
1498
+ match option is set to a pattern that ignores test_ prefixed .py filenames.
1499
+ When pydocstyle is invoked with full path to `test_a.py`, we expect it to
1500
+ succeed since match option will match against just the file name and not
1501
+ full path.
1502
+ """
1503
+ # Ignore .py files prefixed with 'test_'
1504
+ env .write_config (select = 'D100' , match = '(?!test_).+.py' )
1505
+
1506
+ # Create an empty module (violates D100)
1507
+ with env .open ('test_a.py' , 'wt' ) as test :
1508
+ test .write ('' )
1509
+
1510
+ # env.invoke calls pydocstyle with full path to test_a.py
1511
+ out , _ , code = env .invoke (target = 'test_a.py' )
1512
+ assert '' == out
1513
+ assert code == 0
You can’t perform that action at this time.
0 commit comments