Fixup broken bundle alias.

Review Request #722 - Created July 23, 2014 and submitted

Information
John Sirois
pants
jsirois/issues/375/bundle_scope
375, 377
Reviewers
pants-reviews
areitz, lahosken, stuhood, tejal
commit 9c52f8dc4b2641a4b5e7d6008f2e292e9c01eb4f
Author: John Sirois <jsirois@twitter.com>
Date:   Tue Jul 22 19:04:36 2014 -0600

    Fixup broken bundle alias.
    
    Bundle was incorrectly saving mutable state at BUILD file scope instead of
    per-use scope.  This change adds a factory method at the BUILD file scope
    (parse_context), and collapses the __init__ and __call__ into one. This is both
    clearer and now not broken.
    
    Add a test to exercise this - creating >1 bundle in a BUILD file.
    
    In the course of adding this test, find an fix a bug in BuildFileAliases.merge.
    Consequently, add a comprehensive test for BuildFileAliases.

 src/python/pants/backend/jvm/register.py                |  6 +---
 src/python/pants/backend/jvm/targets/jvm_binary.py      | 20 ++++++-----
 src/python/pants/base/build_file_aliases.py             |  4 ++-
 tests/python/pants_test/base/BUILD                      | 11 ++++++
 tests/python/pants_test/base/test_build_file_aliases.py | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/python/pants_test/targets/BUILD                   |  5 ++-
 tests/python/pants_test/targets/test_jvm_app.py         | 63 +++++++++++++++++++++++-----------
 7 files changed, 163 insertions(+), 37 deletions(-)
$ PANTS_DEV=1 ./pants goal test tests/python/pants_test/base:build_file_aliases tests/python/pants_test/targets/:jvm_app --test-pytest-options=-v
*** Running pants in dev mode from /home/jsirois/dev/3rdparty/jsirois-pants/src/python/pants/bin/pants_exe.py ***
...
19:06:07 00:00   [test]
19:06:07 00:00     [pytest]
19:06:07 00:00       [run]
                     ============== test session starts ===============
                     platform linux2 -- Python 2.6.9 -- py-1.4.22 -- pytest-2.6.0 -- /usr/bin/python2.6
                     plugins: cov, timeout
                     collected 15 items 
                     
                     tests/python/pants_test/base/test_build_file_aliases.py@15::BuildFileAliasesTest::test_create PASSED
                     tests/python/pants_test/base/test_build_file_aliases.py@61::BuildFileAliasesTest::test_curry_context PASSED
                     tests/python/pants_test/base/test_build_file_aliases.py@72::BuildFileAliasesTest::test_merge PASSED
                     tests/python/pants_test/targets/test_jvm_app.py@36::BinaryTest::test_binary_via_binary PASSED
                     tests/python/pants_test/targets/test_jvm_app.py@49::BinaryTest::test_binary_via_dependencies PASSED
                     tests/python/pants_test/targets/test_jvm_app.py@62::BinaryTest::test_degenerate_binaries PASSED
                     tests/python/pants_test/targets/test_jvm_app.py@76::BinaryTest::test_no_binary PASSED
                     tests/python/pants_test/targets/test_jvm_app.py@115::BinaryTest::test_not_a_binary PASSED
                     tests/python/pants_test/targets/test_jvm_app.py@88::BinaryTest::test_too_many_binaries_mixed PASSED
                     tests/python/pants_test/targets/test_jvm_app.py@102::BinaryTest::test_too_many_binaries_via_deps PASSED
                     tests/python/pants_test/targets/test_jvm_app.py@201::BundleTest::test_bundle_add_add PASSED
                     tests/python/pants_test/targets/test_jvm_app.py@158::BundleTest::test_bundle_filemap_dest_byglobs PASSED
                     tests/python/pants_test/targets/test_jvm_app.py@139::BundleTest::test_bundle_filemap_dest_bypath PASSED
                     tests/python/pants_test/targets/test_jvm_app.py@180::BundleTest::test_bundle_filemap_dest_relative PASSED
                     tests/python/pants_test/targets/test_jvm_app.py@226::BundleTest::test_multiple_bundles PASSED
                     
                     =========== 15 passed in 0.35 seconds ============
                     
19:06:09 00:02     [junit]
19:06:09 00:02     [specs]
               SUCCESS
John Sirois
Stu Hood
John Sirois
John Sirois
John Sirois
Ity Kaul
John Sirois
John Sirois
Review request changed

Status: Closed (submitted)

Larry Hosken
> Larry - this has a test for curry_context

YAY
Loading...