File tree Expand file tree Collapse file tree 1 file changed +25
-7
lines changed
Expand file tree Collapse file tree 1 file changed +25
-7
lines changed Original file line number Diff line number Diff line change 44
55import json
66import os
7- from pathlib import Path
7+ import pathlib
88
99import pytest
1010
@@ -582,14 +582,32 @@ def check_cmd(config_arg):
582582
583583 assert 'file not found' in check_cmd ('.tmuxp.json' )
584584
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 ()
589585
586+ def test_ls_cli (monkeypatch , tmpdir ):
590587 monkeypatch .setenv ("HOME" , str (tmpdir ))
591588
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 ()
593610
611+ runner = CliRunner ()
594612 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