forked from mrkn/pycall.rb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspec_helper.rb
48 lines (39 loc) · 1.04 KB
/
spec_helper.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
puts
puts "Environment variables:"
%w[
ANACONDA
LIBPYTHON
PYENV_VERSION
PYTHON
PYTHON_VERSION
PYTHONPATH
PYCALL_DEBUG_FIND_LIBPYTHON
].each do |key|
puts "- #{key}=#{ENV[key]}"
end
require "pycall"
puts
puts "The following version of Python is used:"
puts PyCall::PYTHON_DESCRIPTION
require 'pycall/import'
require "pycall/pretty_print"
require 'pycall/spec_helper.so'
PyCall.sys.path.append(File.expand_path('../python', __FILE__))
Dir.glob(File.expand_path('../support/**/*.rb', __FILE__)) do |file|
require file
end
RSpec.configure do |config|
config.disable_monkey_patching!
config.expose_current_running_example_as :example
config.filter_run_when_matching :focus
config.order = :random
config.seed = ENV['RSPEC_SEED'] if ENV['RSPEC_SEED']
config.profile_examples = true if ENV['RSPEC_PROFILING']
config.after do
if PyCall::PyError.occurred?
pyerr = PyCall::PyError.fetch
raise "unhandled python exception: #{pyerr}" if pyerr
end
end
end