lib/autoproj/test.rb in autoproj-2.11.0 vs lib/autoproj/test.rb in autoproj-2.12.0
- old
+ new
@@ -69,19 +69,21 @@
@ws = nil
@ws_package_managers = Hash.new
Autobuild.logdir = make_tmpdir
ws_define_package_manager 'os'
ws_define_package_manager 'os_indep'
+ Autobuild.progress_display_period = 0
super
end
def teardown
super
@tmpdir.each do |dir|
FileUtils.remove_entry_secure dir
end
+ Rake::Task.clear
Autobuild::Package.clear
Autoproj.silent = false
stop_gem_server if @gem_server_pid
@@ -92,10 +94,15 @@
if ENV.delete('AUTOPROJ_CURRENT_ROOT')
raise "AUTOPROJ_CURRENT_ROOT has been set by this test !!!!"
end
end
+ def data_path(*args)
+ File.expand_path(File.join(*args),
+ File.join(__dir__, '..', '..', 'test', 'data'))
+ end
+
def create_bootstrap
ws_create
end
def skip_long_tests?
@@ -168,11 +175,11 @@
default_env = Hash[
'TEST_COMMAND_NAME' => to_s.gsub(/[^\w]/, '_'),
'PACKAGE_BASE_DIR' => package_base_dir,
'RUBY' => Gem.ruby
]
- result = Bundler.clean_system(
+ result = Autoproj.bundler_unbundled_system(
default_env.merge(env), script, *arguments,
in: :close, **Hash[chdir: dir].merge(system_options))
end
if !result
@@ -199,21 +206,21 @@
vendor = File.join(__dir__, '..', '..', 'vendor')
bundler_filename = "bundler-#{Bundler::VERSION}.gem"
cached_bundler_gem = File.join(vendor, bundler_filename)
unless File.file?(cached_bundler_gem)
FileUtils.mkdir_p vendor
- Bundler.clean_system(
+ Autoproj.bundler_unbundled_system(
Ops::Install.guess_gem_program, 'fetch', '-v',
Bundler::VERSION, 'bundler', chdir: vendor)
unless File.file?(bundler_filename)
raise "cannot download the bundler gem"
end
end
capture_subprocess_io do
- Bundler.clean_system(
+ Autoproj.bundler_unbundled_system(
Hash['GEM_HOME' => fixture_gem_home, 'GEM_PATH' => nil],
Ops::Install.guess_gem_program, 'install', '--no-document',
cached_bundler_gem)
end
end
@@ -254,11 +261,11 @@
Autoproj.warn_deprecated_level = level
end
def find_bundled_gem_path(bundler, gem_name, gemfile)
out_r, out_w = IO.pipe
- result = Bundler.clean_system(
+ result = Autoproj.bundler_unbundled_system(
bundler, 'show', gem_name,
out: out_w,
chdir: File.dirname(gemfile))
out_w.close
output = out_r.read.chomp
@@ -368,12 +375,19 @@
end
end
def ws_define_package(package_type, package_name,
package_set: ws.manifest.main_package_set,
- create: true)
+ create: true, &block)
package = Autobuild.send(package_type, package_name)
- package.srcdir = File.join(ws.root_dir, package_name.to_s)
+ ws_setup_package(
+ package, package_set: package_set, create: create, &block
+ )
+ end
+
+ def ws_setup_package(package, package_set: ws.manifest.main_package_set,
+ create: true)
+ package.srcdir = File.join(ws.root_dir, package.name.to_s)
FileUtils.mkdir_p package.srcdir if create
autoproj_package = ws.register_package(package, nil, package_set)
yield(package) if block_given?
autoproj_package
end