def test_provided(self):
        test_path = 'testprojects/maven_layout/provided_patching'
        stdout_list = self.run_pants(['-q', 'list', f'{test_path}::'
                                      ]).stdout_data.strip().split()
        suffix = 'provided'

        hash_1 = hash_target(
            'testprojects/maven_layout/provided_patching/one/src/main/java:shadow',
            suffix)
        hash_2 = hash_target(
            'testprojects/maven_layout/provided_patching/two/src/main/java:shadow',
            suffix)
        hash_3 = hash_target(
            'testprojects/maven_layout/provided_patching/three/src/main/java:shadow',
            suffix)

        self.assertIn(
            f'testprojects/maven_layout/provided_patching/one/src/main/java:shadow-unstable-{suffix}-{hash_1}',
            stdout_list)

        self.assertIn(
            f'testprojects/maven_layout/provided_patching/two/src/main/java:shadow-unstable-{suffix}-{hash_2}',
            stdout_list)

        self.assertIn(
            f'testprojects/maven_layout/provided_patching/three/src/main/java:shadow-unstable-{suffix}-{hash_3}',
            stdout_list)

        self.assertIn(
            f'testprojects/maven_layout/provided_patching/leaf:shadow-unstable-{suffix}-{hash_2}',
            stdout_list)
  def test_provided(self):
    test_path = 'testprojects/maven_layout/provided_patching'
    stdout_list = self.run_pants(['-q', 'list', '{}::'.format(test_path)]).stdout_data.strip().split()
    suffix = 'provided'

    hash_1 = hash_target('testprojects/maven_layout/provided_patching/one/src/main/java:shadow', suffix)
    hash_2 = hash_target('testprojects/maven_layout/provided_patching/two/src/main/java:shadow', suffix)
    hash_3 = hash_target('testprojects/maven_layout/provided_patching/three/src/main/java:shadow', suffix)

    self.assertIn(
      'testprojects/maven_layout/provided_patching/one/src/main/java:shadow-unstable-{}-{}'.format(suffix, hash_1),
      stdout_list
    )

    self.assertIn(
      'testprojects/maven_layout/provided_patching/two/src/main/java:shadow-unstable-{}-{}'.format(suffix, hash_2),
      stdout_list
    )

    self.assertIn(
      'testprojects/maven_layout/provided_patching/three/src/main/java:shadow-unstable-{}-{}'.format(suffix, hash_3),
      stdout_list
    )

    self.assertIn(
      'testprojects/maven_layout/provided_patching/leaf:shadow-unstable-{}-{}'.format(suffix, hash_2),
      stdout_list
    )
Ejemplo n.º 3
0
    def test_provided(self):
        test_path = 'testprojects/maven_layout/provided_patching'
        stdout_list = self.run_pants(['-q', 'list', '{}::'.format(test_path)
                                      ]).stdout_data.strip().split()
        suffix = 'provided'

        hash_1 = hash_target(
            'testprojects/maven_layout/provided_patching/one/src/main/java:shadow',
            suffix)
        hash_2 = hash_target(
            'testprojects/maven_layout/provided_patching/two/src/main/java:shadow',
            suffix)
        hash_3 = hash_target(
            'testprojects/maven_layout/provided_patching/three/src/main/java:shadow',
            suffix)

        self.assertIn(
            'testprojects/maven_layout/provided_patching/one/src/main/java:shadow-unstable-{}-{}'
            .format(suffix, hash_1), stdout_list)

        self.assertIn(
            'testprojects/maven_layout/provided_patching/two/src/main/java:shadow-unstable-{}-{}'
            .format(suffix, hash_2), stdout_list)

        self.assertIn(
            'testprojects/maven_layout/provided_patching/three/src/main/java:shadow-unstable-{}-{}'
            .format(suffix, hash_3), stdout_list)

        self.assertIn(
            'testprojects/maven_layout/provided_patching/leaf:shadow-unstable-{}-{}'
            .format(suffix, hash_2), stdout_list)
Ejemplo n.º 4
0
    def test_scoped(self):
        test_path = 'testprojects/src/java/org/pantsbuild/testproject/runtime'
        scoped_address = '3rdparty:gson'
        stdout_list = self.run_pants(['-q', 'list', '{}:'.format(test_path)
                                      ]).stdout_data.strip().split()

        hash_1 = hash_target(scoped_address, 'compile')
        hash_2 = hash_target(scoped_address, 'runtime')
        self.assertIn(
            'testprojects/src/java/org/pantsbuild/testproject/runtime:gson-unstable-compile-{}'
            .format(hash_1), stdout_list)

        self.assertIn(
            'testprojects/src/java/org/pantsbuild/testproject/runtime:gson-unstable-runtime-{}'
            .format(hash_2), stdout_list)
  def test_scoped(self):
    test_path = 'testprojects/src/java/org/pantsbuild/testproject/runtime'
    scoped_address = '3rdparty:gson'
    stdout_list = self.run_pants(['-q', 'list', '{}:'.format(test_path)]).stdout_data.strip().split()

    hash_1 = hash_target(scoped_address, 'compile')
    hash_2 = hash_target(scoped_address, 'runtime')
    self.assertIn(
      'testprojects/src/java/org/pantsbuild/testproject/runtime:gson-unstable-compile-{}'.format(hash_1),
      stdout_list
    )

    self.assertIn(
      'testprojects/src/java/org/pantsbuild/testproject/runtime:gson-unstable-runtime-{}'.format(hash_2),
      stdout_list
    )
Ejemplo n.º 6
0
    def test_intransitive(self):
        test_path = 'testprojects/src/java/org/pantsbuild/testproject/intransitive'
        stdout_list = self.run_pants(['-q', 'list', '{}:'.format(test_path)
                                      ]).stdout_data.strip().split()
        suffix = 'intransitive'

        hash_b = hash_target('{}:b'.format(test_path), suffix)
        hash_c = hash_target('{}:c'.format(test_path), suffix)

        self.assertIn(
            'testprojects/src/java/org/pantsbuild/testproject/intransitive:b-unstable-{}-{}'
            .format(suffix, hash_b), stdout_list)

        self.assertIn(
            'testprojects/src/java/org/pantsbuild/testproject/intransitive:c-unstable-{}-{}'
            .format(suffix, hash_c), stdout_list)
    def test_intransitive(self):
        test_path = 'testprojects/src/java/org/pantsbuild/testproject/intransitive'
        stdout_list = self.run_pants(['-q', 'list', f'{test_path}:'
                                      ]).stdout_data.strip().split()
        suffix = 'intransitive'

        hash_b = hash_target(f'{test_path}:b', suffix)
        hash_c = hash_target(f'{test_path}:c', suffix)

        self.assertIn(
            f'testprojects/src/java/org/pantsbuild/testproject/intransitive:b-unstable-{suffix}-{hash_b}',
            stdout_list)

        self.assertIn(
            f'testprojects/src/java/org/pantsbuild/testproject/intransitive:c-unstable-{suffix}-{hash_c}',
            stdout_list)
  def test_intransitive(self):
    test_path = 'testprojects/src/java/org/pantsbuild/testproject/intransitive'
    stdout_list = self.run_pants(['-q', 'list', '{}:'.format(test_path)]).stdout_data.strip().split()
    suffix = 'intransitive'

    hash_b = hash_target('{}:b'.format(test_path), suffix)
    hash_c = hash_target('{}:c'.format(test_path), suffix)

    self.assertIn(
      'testprojects/src/java/org/pantsbuild/testproject/intransitive:b-unstable-{}-{}'.format(suffix, hash_b),
      stdout_list
    )

    self.assertIn(
      'testprojects/src/java/org/pantsbuild/testproject/intransitive:c-unstable-{}-{}'.format(suffix, hash_c),
      stdout_list
    )
Ejemplo n.º 9
0
 def test_intransitive_and_scope(self):
   with self.temporary_workdir() as workdir:
     test_path = 'testprojects/maven_layout/provided_patching/one/src/main/java'
     test_target = '{}:common'.format(test_path)
     json_data = self.run_export(test_target, workdir)
     h = hash_target('{}:shadow'.format(test_path), 'provided')
     synthetic_target = '{}:shadow-unstable-provided-{}'.format(test_path, h)
     self.assertEquals(False, json_data['targets'][synthetic_target]['transitive'])
     self.assertEquals('compile test', json_data['targets'][synthetic_target]['scope'])
 def test_intransitive_and_scope(self):
   with self.temporary_workdir() as workdir:
     test_path = 'testprojects/maven_layout/provided_patching/one/src/main/java'
     test_target = '{}:common'.format(test_path)
     json_data = self.run_export(test_target, workdir)
     h = hash_target('{}:shadow'.format(test_path), 'provided')
     synthetic_target = '{}:shadow-unstable-provided-{}'.format(test_path, h)
     self.assertEquals(False, json_data['targets'][synthetic_target]['transitive'])
     self.assertEquals('compile test', json_data['targets'][synthetic_target]['scope'])
Ejemplo n.º 11
0
 def test_intransitive_and_scope(self):
     with self.temporary_workdir() as workdir:
         test_path = "testprojects/maven_layout/provided_patching/one/src/main/java"
         test_target = f"{test_path}:common"
         json_data = self.run_export(test_target, workdir)
         h = hash_target(f"{test_path}:shadow", "provided")
         synthetic_target = f"{test_path}:shadow-unstable-provided-{h}"
         self.assertEqual(False, json_data["targets"][synthetic_target]["transitive"])
         self.assertEqual("compile test", json_data["targets"][synthetic_target]["scope"])
    def test_no_redundant_target(self):
        # TODO: Create another BUILD.other file with same provided scope,
        # once we resolve https://github.com/pantsbuild/pants/issues/3933
        test_path = 'testprojects/maven_layout/provided_patching/one/src/main/java'
        stdout_list = self.run_pants(['-q', 'list', f'{test_path}::'
                                      ]).stdout_data.strip().split()
        suffix = 'provided'

        hash = hash_target(f'{test_path}:shadow', suffix)
        synthetic_target = f'{test_path}:shadow-unstable-{suffix}-{hash}'
        self.assertEqual(stdout_list.count(synthetic_target), 1)
  def test_no_redundant_target(self):
    # TODO: Create another BUILD.other file with same provided scope,
    # once we resolve https://github.com/pantsbuild/pants/issues/3933
    test_path = 'testprojects/maven_layout/provided_patching/one/src/main/java'
    stdout_list = self.run_pants(['-q', 'list', '{}::'.format(test_path)]).stdout_data.strip().split()
    suffix = 'provided'

    hash = hash_target('{}:shadow'.format(test_path), suffix)
    synthetic_target = '{}:shadow-unstable-{}-{}'.format(test_path, suffix, hash)
    self.assertEqual(
      stdout_list.count(synthetic_target),
      1
    )