def test_binary_target_injected_into_minified_dependencies(self): foo_bin_dep = self.make_target( spec = ':foo_bin_dep', target_type = PythonLibrary, ) foo_bin = self.make_target( spec = ':foo_bin', target_type = PythonBinary, entry_point = 'foo.bin.foo', dependencies = [ foo_bin_dep, ] ) foo = self.make_target( spec = ':foo', target_type = PythonLibrary, provides = PythonArtifact( name = 'foo', version = '0.0.0', ).with_binaries( foo_binary = ':foo_bin', ) ) 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)
def test_binary_target_injected_into_minified_dependencies(self): foo_bin_dep = self.make_target( spec=':foo_bin_dep', target_type=PythonLibrary, ) foo_bin = self.make_target(spec=':foo_bin', target_type=PythonBinary, entry_point='foo.bin.foo', dependencies=[ foo_bin_dep, ]) foo = self.make_target(spec=':foo', target_type=PythonLibrary, provides=PythonArtifact( name='foo', version='0.0.0', ).with_binaries(foo_binary=':foo_bin', )) self.assertEqual(SetupPy.minified_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 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)
def test_binary_target_injected_into_minified_dependencies_with_provider(self): bar_bin_dep = self.make_target( spec = ':bar_bin_dep', target_type = PythonLibrary, provides = PythonArtifact( name = 'bar_bin_dep', version = '0.0.0', ) ) bar_bin = self.make_target( spec = ':bar_bin', target_type = PythonBinary, entry_point = 'bar.bin.bar', dependencies = [ bar_bin_dep, ], ) bar = self.make_target( spec = ':bar', target_type = PythonLibrary, provides = PythonArtifact( name = 'bar', version = '0.0.0', ).with_binaries( bar_binary = ':bar_bin' ) ) # TODO(pl): Why is this set ordered? Does the order actually matter? assert SetupPy.minified_dependencies(bar) == OrderedSet([bar_bin, bar_bin_dep]) assert SetupPy.install_requires(bar) == set(['bar_bin_dep==0.0.0']) 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)
def test_binary_target_injected_into_minified_dependencies_with_provider( self): bar_bin_dep = self.make_target(spec=':bar_bin_dep', target_type=PythonLibrary, provides=PythonArtifact( name='bar_bin_dep', version='0.0.0', )) bar_bin = self.make_target( spec=':bar_bin', target_type=PythonBinary, entry_point='bar.bin.bar', dependencies=[ bar_bin_dep, ], ) bar = self.make_target(spec=':bar', target_type=PythonLibrary, provides=PythonArtifact( name='bar', version='0.0.0', ).with_binaries(bar_binary=':bar_bin')) # TODO(pl): Why is this set ordered? Does the order actually matter? assert SetupPy.minified_dependencies(bar) == OrderedSet( [bar_bin, bar_bin_dep]) assert SetupPy.install_requires(bar) == set(['bar_bin_dep==0.0.0']) 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)