File tree 1 file changed +25
-7
lines changed
1 file changed +25
-7
lines changed Original file line number Diff line number Diff line change 4
4
5
5
import json
6
6
import os
7
- from pathlib import Path
7
+ import pathlib
8
8
9
9
import pytest
10
10
@@ -582,14 +582,32 @@ def check_cmd(config_arg):
582
582
583
583
assert 'file not found' in check_cmd ('.tmuxp.json' )
584
584
585
- def test_ls_cli (monkeypatch , tmpdir ):
586
- tmpdir .join ('.tmuxp/session_1.yaml' ).ensure ()
587
- tmpdir .join ('.tmuxp/session_2.yaml' ).ensure ()
588
- tmpdir .join ('.tmuxp/session_3.json' ).ensure ()
589
585
586
+ def test_ls_cli (monkeypatch , tmpdir ):
590
587
monkeypatch .setenv ("HOME" , str (tmpdir ))
591
588
592
- runner = CliRunner ()
589
+ filenames = [
590
+ '.git/' ,
591
+ '.gitignore/' ,
592
+ 'session_1.yaml' ,
593
+ 'session_2.yaml' ,
594
+ 'session_3.json' ,
595
+ 'session_4.txt' ,
596
+ ]
597
+
598
+ # should ignore:
599
+ # - directories should be ignored
600
+ # - extensions not covered in VALID_CONFIG_DIR_FILE_EXTENSIONS
601
+ ignored_filenames = ['.git/' , '.gitignore/' , 'session_4.txt' ]
602
+ stems = [pathlib .PurePath (f ).stem for f in filenames if f not in ignored_filenames ]
603
+
604
+ for filename in filenames :
605
+ location = tmpdir .join ('.tmuxp/{}' .format (filename ))
606
+ if filename .endswith ('/' ):
607
+ location .ensure_dir ()
608
+ else :
609
+ location .ensure ()
593
610
611
+ runner = CliRunner ()
594
612
cli_output = runner .invoke (command_ls ).output
595
- assert cli_output == 'session_1 \n session_2 \n session_3 \n '
613
+ assert cli_output == '\n ' . join ( stems ) + ' \n '
You can’t perform that action at this time.
0 commit comments