Fixup BuildFile must_exist logic.

Review Request #2441 - Created July 8, 2015 and submitted

Information
John Sirois
pants
jsirois/issues/1742
1742, 1774
4360d14...
Reviewers
pants-reviews
dturner-tw, zundel
Relax the BuildFile.must_exist logic to ensure a logical BUILD file
exists.  Previously the logic required the primary canonical BUILD file
(no extension) to be a valid BUILD file and not a directory if a valid
sibling BUILD file existed.

This change adds a failing test that is then fixed.
Along the way, centralize BUILD file `._isfile` testing in
`_get_all_build_files`.

 src/python/pants/base/build_file.py                                                | 52 +++++++++++++++++++++-----------------------------
 tests/python/pants_test/base/BUILD                                                 |  7 +++----
 tests/python/pants_test/base/build_file_test_base.py                               | 10 ++++++----
 tests/python/pants_test/base/{test_build_file.py => test_filesystem_build_file.py} | 13 +++++++++++--
 4 files changed, 42 insertions(+), 40 deletions(-)

Before fix, the new test failed like so:

$ ./pants test tests/python/pants_test/base:filesystem_build_file -- -ktest_dir_is_primary
...
                     E         MissingBuildFileError: Path to buildfile (/tmp/tmp7ZEf8n/root/issue_1742/BUILD) is a directory, but it must be a file.

                     src/python/pants/base/build_file.py:167: MissingBuildFileError
...

CI went green here:
https://travis-ci.org/pantsbuild/pants/builds/70123652

David Turner
Eric Ayers
John Sirois
John Sirois
Review request changed

Status: Closed (submitted)

Loading...