thefuck/tests
Ryan Delaney fe1942866b
#1133: Match commands with path prefixes in @for_app decorations
* Resolve paths before checking app identity

Commands entered with a path do not match is_app. I encountered this
when working with a test for the rm_dir rule. This rule did not use the
@for_app decorator, but when I migrated it, the test for "./bin/hdfs.."
failed because 'hdfs' was recognized as a command, while "./bin/hdfs"
was not.

This commit addresses the false negative by resolving path names in the
command, via os.path.basename.

* Remove paths from for_app invocations in rules

I presume that the `./` in `./gradlew` was used here because thefuck
would not find an app match on just `gradlew`, and thus no fucks would
be given on the most common and idiomatic way of invoking gradlew.

After 8faf9b1, thefuck does not distinguish between commands with
paths and those without. Therefore, the tests for this rule are now
broken because thefuck strips paths from the _user_'s command, but not
from the for_app decoration.

This commit addresses that problem by changing the for_app decoration to
this rule.
2021-07-07 23:05:55 +02:00
..
entrypoints #682: Ensure that `script` exists 2017-09-03 10:10:50 +02:00
functional #N/A: Remove performance tests as they are meaningless with the current implementation 2018-11-21 19:44:07 +01:00
output_readers Some improvements (#846) 2018-10-08 22:32:30 +02:00
rules #1210: Add rule 'rails_migrations_pending' 2021-07-06 12:52:54 +02:00
shells #N/A: Improve how version is fetched for all shells (#920) 2019-05-27 18:24:55 +02:00
specific #682: Unify work with output in classic and instant mode 2017-08-31 17:58:56 +02:00
__init__.py Fix tests with python 2 2015-04-25 03:13:57 +02:00
conftest.py Fix pytest warnings (#1116) 2020-11-03 18:29:28 +01:00
test_argument_parser.py #682: Use our own shell logger, fix experimental instant mode on macos 2017-10-08 16:17:41 +02:00
test_conf.py Add excluded_search_path_prefixes setting (#1165) 2021-04-21 19:43:21 +02:00
test_corrector.py #1113: Ignore a rule that fails to load (#1124) 2020-11-03 18:26:13 +01:00
test_logs.py Fix some more warnings from flake8 2015-11-15 18:08:59 +01:00
test_readme.py Minor refactoring 2015-09-08 15:24:49 +03:00
test_types.py #1141: Fix crash on empty history (#1145) 2020-11-18 10:43:11 +01:00
test_ui.py #682: Fix tests and flake8 2017-08-26 06:16:51 +02:00
test_utils.py #1133: Match commands with path prefixes in @for_app decorations 2021-07-07 23:05:55 +02:00
utils.py #682: Unify work with output in classic and instant mode 2017-08-31 17:58:56 +02:00