Skip to content

Commit

Permalink
Merge 602b5f1 into 59a4d3f
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimebuelta committed Oct 20, 2018
2 parents 59a4d3f + 602b5f1 commit 105e6c8
Show file tree
Hide file tree
Showing 20 changed files with 56 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ matrix:
before_script:
- pip install pyflakes cram python-coveralls codecov
script:
- pyflakes *.py ffind/*.py
- pyflakes *.py src/ffind/*.py
- python setup.py install
- ffind --ignore-vcs . '(?<!argparse).py$' --exec=pyflakes
- make travis
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from setuptools import setup
from setuptools.command.install import install
from setuptools import find_packages

import os
import subprocess
Expand Down Expand Up @@ -51,7 +52,8 @@ def run(self):
install_requires=['setuptools'],
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, <4',
keywords=['searching', 'file system'],
packages=['ffind'],
packages=find_packages('src'),
package_dir={'': 'src'},
entry_points={
'console_scripts': ['ffind = ffind.ffind:run'],
},
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ Setup

Run test

$ $PYTHON $TESTDIR/../ffind/ffind.py test1
$ $PYTHON $FFIND_PY test1
./test_dir/test1.py
./test_dir/second_level/stest1.py
2 changes: 1 addition & 1 deletion tests/caps.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ Setup

Run test

$ $PYTHON $TESTDIR/../ffind/ffind.py Test
$ $PYTHON $FFIND_PY Test
./test_dir/Test2.py
./test_dir/second_level/sTest2.py
20 changes: 10 additions & 10 deletions tests/case_sensitive.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,39 @@ Setup

Run test

$ $PYTHON $TESTDIR/../ffind/ffind.py test2
$ $PYTHON $FFIND_PY test2
./test_dir/Test2.py
./test_dir/second_level/sTest2.py

$ $PYTHON $TESTDIR/../ffind/ffind.py -c Test2
$ $PYTHON $FFIND_PY -c Test2
./test_dir/Test2.py
./test_dir/second_level/sTest2.py

$ $PYTHON $TESTDIR/../ffind/ffind.py -c test2
$ $PYTHON $FFIND_PY -c test2

$ $PYTHON $TESTDIR/../ffind/ffind.py -i STEST1
$ $PYTHON $FFIND_PY -i STEST1
./test_dir/second_level/stest1.py

$ $PYTHON $TESTDIR/../ffind/ffind.py -i -c Test2
$ $PYTHON $FFIND_PY -i -c Test2
./test_dir/Test2.py
./test_dir/second_level/sTest2.py


Run the tests with environment variables

$ $PYTHON $TESTDIR/../ffind/ffind.py test2
$ $PYTHON $FFIND_PY test2
./test_dir/Test2.py
./test_dir/second_level/sTest2.py

$ FFIND_CASE_SENSITIVE=1 $PYTHON $TESTDIR/../ffind/ffind.py Test2
$ FFIND_CASE_SENSITIVE=1 $PYTHON $FFIND_PY Test2
./test_dir/Test2.py
./test_dir/second_level/sTest2.py

$ FFIND_CASE_SENSITIVE=1 $PYTHON $TESTDIR/../ffind/ffind.py test2
$ FFIND_CASE_SENSITIVE=1 $PYTHON $FFIND_PY test2

$ FFIND_CASE_INSENSITIVE=1 $PYTHON $TESTDIR/../ffind/ffind.py STEST1
$ FFIND_CASE_INSENSITIVE=1 $PYTHON $FFIND_PY STEST1
./test_dir/second_level/stest1.py

$ FFIND_CASE_SENSITIVE=1 FFIND_CASE_INSENSITIVE=1 $PYTHON $TESTDIR/../ffind/ffind.py Test2
$ FFIND_CASE_SENSITIVE=1 FFIND_CASE_INSENSITIVE=1 $PYTHON $FFIND_PY Test2
./test_dir/Test2.py
./test_dir/second_level/sTest2.py
4 changes: 2 additions & 2 deletions tests/command.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Setup
Run test (we know the error is converting implicitly int to str, but the error is different
in different versions of python)

$ $PYTHON $TESTDIR/../ffind/ffind.py --command "print('file:' + filename)" stest1
$ $PYTHON $FFIND_PY --command "print('file:' + filename)" stest1
file:./test_dir/second_level/stest1.py
$ $PYTHON $TESTDIR/../ffind/ffind.py --command "print('file:' + filename + 1)" stest1
$ $PYTHON $FFIND_PY --command "print('file:' + filename + 1)" stest1
*str* (glob)
[1]
14 changes: 7 additions & 7 deletions tests/delete.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ Setup

Run test

$ $PYTHON $TESTDIR/../ffind/ffind.py test1
$ $PYTHON $FFIND_PY test1
./test_dir/test1.py
./test_dir/second_level/stest1.py
$ $PYTHON $TESTDIR/../ffind/ffind.py --delete stest1
$ $PYTHON $TESTDIR/../ffind/ffind.py test1
$ $PYTHON $FFIND_PY --delete stest1
$ $PYTHON $FFIND_PY test1
./test_dir/test1.py
$ $PYTHON $TESTDIR/../ffind/ffind.py third_level
$ $PYTHON $FFIND_PY third_level
./test_dir/second_level/third_level
$ $PYTHON $TESTDIR/../ffind/ffind.py --delete third_level
$ $PYTHON $TESTDIR/../ffind/ffind.py third_level
$ $PYTHON $TESTDIR/../ffind/ffind.py --delete second_level
$ $PYTHON $FFIND_PY --delete third_level
$ $PYTHON $FFIND_PY third_level
$ $PYTHON $FFIND_PY --delete second_level
cannot delete: [Errno *] Directory not empty: './test_dir/second_level' (glob)
[1]
4 changes: 2 additions & 2 deletions tests/execute.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Setup

Run test

$ $PYTHON $TESTDIR/../ffind/ffind.py --exec "cat" stest1
$ $PYTHON $FFIND_PY --exec "cat" stest1
inside of stest1
$ $PYTHON $TESTDIR/../ffind/ffind.py --exec "cat {}{}" stest1
$ $PYTHON $FFIND_PY --exec "cat {}{}" stest1
cat: ./test_dir/second_level/stest1.py./test_dir/second_level/stest1.py: No such file or directory
[1]
6 changes: 3 additions & 3 deletions tests/fuzzy.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ Setup

Run test

$ $PYTHON $TESTDIR/../ffind/ffind.py e1
$ $PYTHON $TESTDIR/../ffind/ffind.py -f e1
$ $PYTHON $FFIND_PY e1
$ $PYTHON $FFIND_PY -f e1
./test_dir/test1.py
./test_dir/second_level/stest1.py

Using environment variable

$ FFIND_FUZZY_SEARCH=1 $PYTHON $TESTDIR/../ffind/ffind.py -f e1
$ FFIND_FUZZY_SEARCH=1 $PYTHON $FFIND_PY -f e1
./test_dir/test1.py
./test_dir/second_level/stest1.py
8 changes: 4 additions & 4 deletions tests/hidden.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ Setup

Run test

$ $PYTHON $TESTDIR/../ffind/ffind.py --hidden config
$ $PYTHON $FFIND_PY --hidden config
./test_dir/.git/config
./test_dir/second_level/config
$ $PYTHON $TESTDIR/../ffind/ffind.py config
$ $PYTHON $FFIND_PY config
./test_dir/second_level/config
$ $PYTHON $TESTDIR/../ffind/ffind.py lib
$ $PYTHON $FFIND_PY lib

Using environment variable

$ FFIND_SEARCH_HIDDEN=1 $PYTHON $TESTDIR/../ffind/ffind.py config
$ FFIND_SEARCH_HIDDEN=1 $PYTHON $FFIND_PY config
./test_dir/.git/config
./test_dir/second_level/config
20 changes: 10 additions & 10 deletions tests/ignore_vcs.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ Setup

Run test

$ $PYTHON $TESTDIR/../ffind/ffind.py --hidden lib
$ $PYTHON $FFIND_PY --hidden lib
./test_dir/.git/library
./test_dir/.venv/library
$ $PYTHON $TESTDIR/../ffind/ffind.py --hidden --ignore-vcs lib
$ $PYTHON $FFIND_PY --hidden --ignore-vcs lib
./test_dir/.venv/library
$ $PYTHON $TESTDIR/../ffind/ffind.py lib
$ $PYTHON $FFIND_PY lib

$ $PYTHON $TESTDIR/../ffind/ffind.py --hidden gitignore
$ $PYTHON $FFIND_PY --hidden gitignore
./test_dir/.gitignore
$ $PYTHON $TESTDIR/../ffind/ffind.py --ignore-vcs gitignore
$ $PYTHON $FFIND_PY --ignore-vcs gitignore

$ $PYTHON $TESTDIR/../ffind/ffind.py --hidden --ignore-vcs gitignore
$ $PYTHON $FFIND_PY --hidden --ignore-vcs gitignore

Env variable

$ FFIND_SEARCH_HIDDEN=1 $PYTHON $TESTDIR/../ffind/ffind.py lib
$ FFIND_SEARCH_HIDDEN=1 $PYTHON $FFIND_PY lib
./test_dir/.git/library
./test_dir/.venv/library
$ FFIND_SEARCH_HIDDEN=1 FFIND_IGNORE_VCS=1 $PYTHON $TESTDIR/../ffind/ffind.py lib
$ FFIND_SEARCH_HIDDEN=1 FFIND_IGNORE_VCS=1 $PYTHON $FFIND_PY lib
./test_dir/.venv/library
$ FFIND_SEARCH_HIDDEN=1 $PYTHON $TESTDIR/../ffind/ffind.py gitignore
$ FFIND_SEARCH_HIDDEN=1 $PYTHON $FFIND_PY gitignore
./test_dir/.gitignore
$ FFIND_IGNORE_VCS=1 $PYTHON $TESTDIR/../ffind/ffind.py gitignore
$ FFIND_IGNORE_VCS=1 $PYTHON $FFIND_PY gitignore
8 changes: 4 additions & 4 deletions tests/module.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ Setup

Run test

$ $PYTHON $TESTDIR/../ffind/ffind.py sTest2
$ $PYTHON $FFIND_PY sTest2
./test_dir/second_level/sTest2.py
$ $PYTHON $TESTDIR/../ffind/ffind.py --module "py_compile {}" sTest2
$ $PYTHON $FFIND_PY --module "py_compile {}" sTest2

Search for compiled file. Needs wildcard as python3 compiled file if different
$ $PYTHON $TESTDIR/../ffind/ffind.py sTest2
$ $PYTHON $FFIND_PY sTest2
./test_dir/second_level/sTest2.py
*sTest2*pyc (glob)

Error in the module
$ $PYTHON $TESTDIR/../ffind/ffind.py --module "badmodule" stest3
$ $PYTHON $FFIND_PY --module "badmodule" stest3
No module named badmodule
[1]
6 changes: 3 additions & 3 deletions tests/path.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Setup

Run test

$ $PYTHON $TESTDIR/../ffind/ffind.py second
$ $PYTHON $FFIND_PY second
./test_dir/second_level

$ $PYTHON $TESTDIR/../ffind/ffind.py -p second
$ $PYTHON $FFIND_PY -p second
./test_dir/second_level
./test_dir/second_level/CVS
./test_dir/second_level/config
Expand All @@ -18,7 +18,7 @@ Run test

Using env variable

$ FFIND_SEARCH_PATH=1 $PYTHON $TESTDIR/../ffind/ffind.py second
$ FFIND_SEARCH_PATH=1 $PYTHON $FFIND_PY second
./test_dir/second_level
./test_dir/second_level/CVS
./test_dir/second_level/config
Expand Down
2 changes: 1 addition & 1 deletion tests/regex.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Setup

Run test

$ $PYTHON $TESTDIR/../ffind/ffind.py py$
$ $PYTHON $FFIND_PY py$
./test_dir/Test2.py
./test_dir/test1.py
./test_dir/second_level/sTest2.py
Expand Down
2 changes: 1 addition & 1 deletion tests/regex2.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ Setup

Run test

$ $PYTHON $TESTDIR/../ffind/ffind.py .test..py
$ $PYTHON $FFIND_PY .test..py
./test_dir/second_level/sTest2.py
./test_dir/second_level/stest1.py
2 changes: 1 addition & 1 deletion tests/return_results.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ Setup

Run test

$ $PYTHON $TESTDIR/../ffind/ffind.py --return-results test1
$ $PYTHON $FFIND_PY --return-results test1
./test_dir/test1.py
./test_dir/second_level/stest1.py
1 change: 1 addition & 0 deletions tests/setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Set a directory with different files to test search capabilities
TEST_DIR=./test_dir
FFIND_PY=$TESTDIR/../src/ffind/ffind.py
mkdir $TEST_DIR
touch $TEST_DIR/test1.py
touch $TEST_DIR/Test2.py
Expand Down
2 changes: 1 addition & 1 deletion tests/wrong_pattern.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Setup

Run test

$ $PYTHON $TESTDIR/../ffind/ffind.py *.t
$ $PYTHON $FFIND_PY *.t
\x1b[31mSorry, the expression *.t is incorrect.\x1b[0m (esc)
Remember that this should be a regular expression.
(https://docs.python.org/howto/regex.html)
Expand Down

0 comments on commit 105e6c8

Please sign in to comment.