Class: LearnTest::Strategies::PythonUnittest
Instance Attribute Summary
#options, #runner
Instance Method Summary
collapse
#argv, #configure, #die, #initialize, #learn_oauth_token, #push_results?, #run_install, #user_id, #username
Instance Method Details
#check_dependencies ⇒ Object
#cleanup ⇒ Object
53
54
55
|
# File 'lib/learn_test/strategies/python_unittest.rb', line 53
def cleanup
FileUtils.rm('.results.json')
end
|
#detect ⇒ Object
11
12
13
|
# File 'lib/learn_test/strategies/python_unittest.rb', line 11
def detect
test_files.any? {|f| f.match(/.*\.py$/) }
end
|
#output ⇒ Object
24
25
26
|
# File 'lib/learn_test/strategies/python_unittest.rb', line 24
def output
@output ||= Oj.load(File.read('.results.json'), symbol_keys: true)
end
|
#results ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/learn_test/strategies/python_unittest.rb', line 32
def results
{
username: username,
github_user_id: user_id,
learn_oauth_token: learn_oauth_token,
repo_name: runner.repo,
build: {
test_suite: [{
framework: 'unittest',
formatted_output: output,
duration: calculate_duration
}]
},
examples: output[:stats][:total],
passing_count: output[:stats][:passes],
pending_count: output[:stats][:skipped],
failure_count: output[:stats][:errors],
failure_descriptions: concat_failure_descriptions
}
end
|
#run ⇒ Object
20
21
22
|
# File 'lib/learn_test/strategies/python_unittest.rb', line 20
def run
system("nosetests #{options[:argv].join(' ')} --verbose --with-json --json-file='./.results.json'")
end
|
#service_endpoint ⇒ Object
7
8
9
|
# File 'lib/learn_test/strategies/python_unittest.rb', line 7
def service_endpoint
'/e/flatiron_unittest'
end
|
#test_files ⇒ Object
28
29
30
|
# File 'lib/learn_test/strategies/python_unittest.rb', line 28
def test_files
@test_files ||= Dir.glob("**/*_test.py")
end
|