Exemplo n.º 1
0
    def test_binary_target_injected_into_minified_dependencies_with_provider(
            self):
        with ParseContext.temp():
            bar = python_library(name='bar',
                                 provides=setup_py(
                                     name='bar',
                                     version='0.0.0',
                                 ).with_binaries(bar_binary=pants(':bar_bin')))

            bar_bin = python_binary(name='bar_bin',
                                    entry_point='bar.bin.bar',
                                    dependencies=[pants(':bar_bin_dep')])

            bar_bin_dep = python_library(name='bar_bin_dep',
                                         provides=setup_py(
                                             name='bar_bin_dep',
                                             version='0.0.0',
                                         ))

        assert SetupPy.minified_dependencies(bar) == OrderedSet(
            [bar_bin, bar_bin_dep])
        entry_points = dict(SetupPy.iter_entry_points(bar))
        assert entry_points == {'bar_binary': 'bar.bin.bar'}

        with self.run_execute(bar, recursive=False) as setup_py_command:
            setup_py_command.run_one.assert_called_with(bar)

        with self.run_execute(bar, recursive=True) as setup_py_command:
            setup_py_command.run_one.assert_has_calls(
                [call(bar), call(bar_bin_dep)], any_order=True)
Exemplo n.º 2
0
  def test_binary_target_injected_into_minified_dependencies(self):
    with ParseContext.temp():
      foo = python_library(
        name = 'foo',
        provides = setup_py(
          name = 'foo',
          version = '0.0.0',
        ).with_binaries(
          foo_binary = pants(':foo_bin')
        )
      )

      foo_bin = python_binary(
        name = 'foo_bin',
        entry_point = 'foo.bin.foo',
        dependencies = [ pants(':foo_bin_dep') ]
      )

      foo_bin_dep = python_library(
        name = 'foo_bin_dep'
      )

    assert SetupPy.minified_dependencies(foo) == OrderedSet([foo_bin, foo_bin_dep])
    entry_points = dict(SetupPy.iter_entry_points(foo))
    assert entry_points == {'foo_binary': 'foo.bin.foo'}

    with self.run_execute(foo, recursive=False) as setup_py_command:
      setup_py_command.run_one.assert_called_with(foo)

    with self.run_execute(foo, recursive=True) as setup_py_command:
      setup_py_command.run_one.assert_called_with(foo)
Exemplo n.º 3
0
    def test_binary_cycle(self):
        with ParseContext.temp():
            foo = python_library(name='foo',
                                 provides=setup_py(
                                     name='foo',
                                     version='0.0.0',
                                 ).with_binaries(foo_binary=pants(':foo_bin')))

            foo_bin = python_binary(name='foo_bin',
                                    entry_point='foo.bin.foo',
                                    dependencies=[pants(':foo')])

        with pytest.raises(TargetDefinitionException):
            SetupPy.minified_dependencies(foo)
Exemplo n.º 4
0
def create_dependencies(depmap):
    target_map = {}
    with ParseContext.temp():
        for name, deps in depmap.items():
            target_map[name] = python_library(
                name=name,
                provides=setup_py(name=name, version='0.0.0'),
                dependencies=[pants(':%s' % dep) for dep in deps])
    return target_map
Exemplo n.º 5
0
def create_dependencies(depmap):
  target_map = {}
  with ParseContext.temp():
    for name, deps in depmap.items():
      target_map[name] = python_library(
        name=name,
        provides=setup_py(name=name, version='0.0.0'),
        dependencies=[pants(':%s' % dep) for dep in deps]
      )
  return target_map
Exemplo n.º 6
0
  def test_binary_cycle(self):
    with ParseContext.temp():
      foo = python_library(
        name = 'foo',
        provides = setup_py(
          name = 'foo',
          version = '0.0.0',
        ).with_binaries(
          foo_binary = pants(':foo_bin')
        )
      )

      foo_bin = python_binary(
        name = 'foo_bin',
        entry_point = 'foo.bin.foo',
        dependencies = [ pants(':foo') ]
      )

    with pytest.raises(TargetDefinitionException):
      SetupPy.minified_dependencies(foo)
Exemplo n.º 7
0
  def test_binary_target_injected_into_minified_dependencies_with_provider(self):
    with ParseContext.temp():
      bar = python_library(
        name = 'bar',
        provides = setup_py(
          name = 'bar',
          version = '0.0.0',
        ).with_binaries(
          bar_binary = pants(':bar_bin')
        )
      )

      bar_bin = python_binary(
        name = 'bar_bin',
        entry_point = 'bar.bin.bar',
        dependencies = [ pants(':bar_bin_dep') ]
      )

      bar_bin_dep = python_library(
        name = 'bar_bin_dep',
        provides = setup_py(
          name = 'bar_bin_dep',
          version = '0.0.0',
        )
      )

    assert SetupPy.minified_dependencies(bar) == OrderedSet([bar_bin, bar_bin_dep])
    entry_points = dict(SetupPy.iter_entry_points(bar))
    assert entry_points == {'bar_binary': 'bar.bin.bar'}

    with self.run_execute(bar, recursive=False) as setup_py_command:
      setup_py_command.run_one.assert_called_with(bar)

    with self.run_execute(bar, recursive=True) as setup_py_command:
      setup_py_command.run_one.assert_has_calls([
          call(bar),
          call(bar_bin_dep)
      ], any_order=True)
Exemplo n.º 8
0
    def test_binary_target_injected_into_minified_dependencies(self):
        with ParseContext.temp():
            foo = python_library(name='foo',
                                 provides=setup_py(
                                     name='foo',
                                     version='0.0.0',
                                 ).with_binaries(foo_binary=pants(':foo_bin')))

            foo_bin = python_binary(name='foo_bin',
                                    entry_point='foo.bin.foo',
                                    dependencies=[pants(':foo_bin_dep')])

            foo_bin_dep = python_library(name='foo_bin_dep')

        assert SetupPy.minified_dependencies(foo) == OrderedSet(
            [foo_bin, foo_bin_dep])
        entry_points = dict(SetupPy.iter_entry_points(foo))
        assert entry_points == {'foo_binary': 'foo.bin.foo'}

        with self.run_execute(foo, recursive=False) as setup_py_command:
            setup_py_command.run_one.assert_called_with(foo)

        with self.run_execute(foo, recursive=True) as setup_py_command:
            setup_py_command.run_one.assert_called_with(foo)