Ejemplo n.º 1
0
    def test_binary_target_injected_into_reduced_dependencies(self):
        foo_bin_dep = self.create_python_library(relpath='foo/dep', name='dep')

        foo_bin = self.create_python_binary(relpath='foo/bin',
                                            name='bin',
                                            entry_point='foo.bin:foo',
                                            dependencies=[
                                                'foo/dep',
                                            ])

        foo = self.create_python_library(relpath='foo',
                                         name='foo',
                                         provides=dedent("""
      setup_py(
        name='foo',
        version='0.0.0'
      ).with_binaries(
        foo_binary='foo/bin'
      )
      """))

        self.assertEqual(self.dependency_calculator.reduced_dependencies(foo),
                         OrderedSet([foo_bin, foo_bin_dep]))
        entry_points = dict(SetupPy.iter_entry_points(foo))
        self.assertEqual(entry_points, {'foo_binary': 'foo.bin:foo'})

        with self.run_execute(foo, recursive=False) as created:
            self.assertEqual([foo], created.keys())

        with self.run_execute(foo, recursive=True) as created:
            self.assertEqual([foo], created.keys())
Ejemplo n.º 2
0
  def test_binary_target_injected_into_reduced_dependencies(self):
    foo_bin_dep = self.create_python_library(relpath='foo/dep', name='dep')

    foo_bin = self.create_python_binary(
      relpath='foo/bin',
      name='bin',
      entry_point='foo.bin:foo',
      dependencies=[
        'foo/dep',
      ]
    )

    foo = self.create_python_library(
      relpath='foo',
      name='foo',
      provides=dedent("""
      setup_py(
        name='foo',
        version='0.0.0'
      ).with_binaries(
        foo_binary='foo/bin'
      )
      """)
    )

    self.assertEqual(self.dependency_calculator.reduced_dependencies(foo),
                     OrderedSet([foo_bin, foo_bin_dep]))
    entry_points = dict(SetupPy.iter_entry_points(foo))
    self.assertEqual(entry_points, {'foo_binary': 'foo.bin:foo'})

    with self.run_execute(foo, recursive=False) as created:
      self.assertEqual([foo], created.keys())

    with self.run_execute(foo, recursive=True) as created:
      self.assertEqual([foo], created.keys())
Ejemplo n.º 3
0
  def test_binary_target_injected_into_reduced_dependencies_with_provider(self):
    bar_bin_dep = self.create_python_library(
      relpath='bar/dep',
      name='dep',
      provides=dedent("""
      setup_py(
        name='bar_bin_dep',
        version='0.0.0'
      )
      """)
    )

    bar_bin = self.create_python_binary(
      relpath='bar/bin',
      name='bin',
      entry_point='bar.bin:bar',
      dependencies=[
        'bar/dep'
      ],
    )

    bar = self.create_python_library(
      relpath='bar',
      name='bar',
      provides=dedent("""
      setup_py(
        name='bar',
        version='0.0.0'
      ).with_binaries(
        bar_binary='bar/bin'
      )
      """)
    )

    self.assertEqual(self.dependency_calculator.reduced_dependencies(bar),
                     OrderedSet([bar_bin, bar_bin_dep]))
    self.assert_requirements(bar, {'bar_bin_dep==0.0.0'})
    entry_points = dict(SetupPy.iter_entry_points(bar))
    self.assertEqual(entry_points, {'bar_binary': 'bar.bin:bar'})

    with self.run_execute(bar, recursive=False) as created:
      self.assertEqual([bar], created.keys())

    with self.run_execute(bar, recursive=True) as created:
      self.assertEqual({bar_bin_dep, bar}, set(created.keys()))
Ejemplo n.º 4
0
    def test_binary_target_injected_into_reduced_dependencies_with_provider(
            self):
        bar_bin_dep = self.create_python_library(relpath='bar/dep',
                                                 name='dep',
                                                 provides=dedent("""
      setup_py(
        name='bar_bin_dep',
        version='0.0.0'
      )
      """))

        bar_bin = self.create_python_binary(
            relpath='bar/bin',
            name='bin',
            entry_point='bar.bin:bar',
            dependencies=['bar/dep'],
        )

        bar = self.create_python_library(relpath='bar',
                                         name='bar',
                                         provides=dedent("""
      setup_py(
        name='bar',
        version='0.0.0'
      ).with_binaries(
        bar_binary='bar/bin'
      )
      """))

        self.assertEqual(self.dependency_calculator.reduced_dependencies(bar),
                         OrderedSet([bar_bin, bar_bin_dep]))
        self.assert_requirements(bar, {'bar_bin_dep==0.0.0'})
        entry_points = dict(SetupPy.iter_entry_points(bar))
        self.assertEqual(entry_points, {'bar_binary': 'bar.bin:bar'})

        with self.run_execute(bar, recursive=False) as created:
            self.assertEqual([bar], created.keys())

        with self.run_execute(bar, recursive=True) as created:
            self.assertEqual({bar_bin_dep, bar}, set(created.keys()))