Sha256: 60430a8fa0ae674478c41c1e68ce3abe855da67549ff2c085319bf7c0c35f144
Contents?: true
Size: 882 Bytes
Versions: 4
Compression:
Stored size: 882 Bytes
Contents
require "open3" module SimControl class PythonEnvironment < BaseEnvironment def initialize(script, results_directory, args = {}) super(results_directory) @script = script @interpreter = args.delete(:interpreter) @virtualenv = args.delete(:virtualenv) raise "passing a virtualenv requires an interpreter" if @virtualenv and not @interpreter end def script @script end def execute(scenario) stdin, stout, stderr, thread = Open3.popen3 command(scenario), chdir: basedir thread.join end def basedir File.dirname @script end def command(scenario) [interpreter, script, scenario].reject(&:nil?).reject(&:empty?).join " " end def interpreter if @virtualenv File.join(@virtualenv, "bin", @interpreter) else @interpreter end end end end
Version data entries
4 entries across 4 versions & 1 rubygems