bee_python 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README +1 -1
- data/lib/bee_task_python.rb +37 -21
- data/python.yml +15 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 819f69e52e0d7f7071d5c620eb2197c157de2d23
|
4
|
+
data.tar.gz: 476fd8ad20f33d803a0406619fbfc0f98b6cbf11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af3177ae7c6b3eccf9de70c5c4a62b6c3ac02a0937eef63edab42922cf9dd8c0ecf117d01963135d90413665b4ab4cfcb84fd959cc11a05d1572f289793328e6
|
7
|
+
data.tar.gz: 9b119ecdfddfe6b33a6258b28fb021f35c30db6dc91eb5ac652c6c52160c9f23eb5027b305561bc2fc537ba0dec95f1d2362f6c8747e693bfa781773cbe411a7
|
data/README
CHANGED
data/lib/bee_task_python.rb
CHANGED
@@ -290,7 +290,9 @@ module Bee
|
|
290
290
|
# - dest: destination directory where to generate coverage report.
|
291
291
|
# Optional, will print report on console if not set.
|
292
292
|
# - data: file where to write coverage data. Optional, defaults to
|
293
|
-
# file .coverage in current directory.
|
293
|
+
# file .coverage in current directory. MUST NOT be set in latest
|
294
|
+
# coverage versions because it doesn't implement this feature
|
295
|
+
# anymore.
|
294
296
|
# - path: a list of directories to add to Python path to run tests.
|
295
297
|
#
|
296
298
|
# Example
|
@@ -300,7 +302,6 @@ module Bee
|
|
300
302
|
# test: "test/suite.py"
|
301
303
|
# dir: "test"
|
302
304
|
# dest: "build/coverage"
|
303
|
-
# data: "build/.coverage"
|
304
305
|
# path: "lib"
|
305
306
|
def coverage(params)
|
306
307
|
# check parameters
|
@@ -317,7 +318,7 @@ module Bee
|
|
317
318
|
test = params[:test]
|
318
319
|
dir = params[:dir]
|
319
320
|
dest = params[:dest]
|
320
|
-
data =
|
321
|
+
data = params[:data]
|
321
322
|
path = params[:path]
|
322
323
|
path = path.map {|d| File.expand_path(d)} if path
|
323
324
|
# manage directories and files
|
@@ -347,32 +348,47 @@ module Bee
|
|
347
348
|
File.exists?(path_dir) and File.directory?(path_dir)
|
348
349
|
end
|
349
350
|
end
|
351
|
+
if data and data.length > 0
|
352
|
+
data_opt = "-f #{data}"
|
353
|
+
else
|
354
|
+
data_opt = ''
|
355
|
+
end
|
350
356
|
# build the python path
|
351
357
|
add_python_path(path)
|
352
358
|
# run coverage command
|
353
359
|
puts "Generating coverage report for #{test_files.length} test(s)..."
|
354
|
-
File.delete(data) if File.exists?(data)
|
355
360
|
prev_dir = Dir.pwd
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
Dir.chdir(prev_dir)
|
361
|
+
begin
|
362
|
+
Dir.chdir(dir)
|
363
|
+
# delete coverage data file
|
364
|
+
if data and File.exists?(data)
|
365
|
+
File.delete(data)
|
366
|
+
elsif File.exists?('.coverage')
|
367
|
+
File.delete('.coverage')
|
364
368
|
end
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
369
|
+
# run all tests
|
370
|
+
for test_file in test_files
|
371
|
+
command = "coverage run --append #{data_opt} #{test_file} 2>/dev/null"
|
372
|
+
if @verbose
|
373
|
+
puts "Running command: '#{command}'"
|
374
|
+
else
|
375
|
+
print '.'
|
376
|
+
end
|
377
|
+
system(command) || error("Error running coverage tests")
|
378
|
+
end
|
379
|
+
puts ''
|
380
|
+
# generate coverage report
|
381
|
+
command = "coverage report #{data_opt} -m #{sources}"
|
374
382
|
puts "Running command: '#{command}'" if @verbose
|
375
383
|
system(command) || error("Error generating coverage report")
|
384
|
+
if dest
|
385
|
+
# generate HTML report
|
386
|
+
command = "coverage html #{data_opt} -d #{dest} #{sources}"
|
387
|
+
puts "Running command: '#{command}'" if @verbose
|
388
|
+
system(command) || error("Error generating coverage report")
|
389
|
+
end
|
390
|
+
ensure
|
391
|
+
Dir.chdir(prev_dir)
|
376
392
|
end
|
377
393
|
end
|
378
394
|
|
data/python.yml
CHANGED
@@ -34,7 +34,7 @@
|
|
34
34
|
# Pylint options
|
35
35
|
py_chk_opt: "--generated-members=objects"
|
36
36
|
# Pylint configuration file
|
37
|
-
py_chk_cfg: "pylint.cfg"
|
37
|
+
py_chk_cfg: "#{File.expand_path('~/.bee/pylint.cfg')}"
|
38
38
|
# list of directories with Python source files to document
|
39
39
|
py_doc_src: ["src", "test"]
|
40
40
|
# directory where to generate source documentation
|
@@ -45,6 +45,9 @@
|
|
45
45
|
py_cov_dir: "#{py_build_dir}/coverage"
|
46
46
|
# List of file patterns to include in report
|
47
47
|
py_cov_inc: ["*.py"]
|
48
|
+
# Coverage data file (connot be specified in latest coverage versions)
|
49
|
+
#py_cov_data: "#{py_build_dir}/.coverage"
|
50
|
+
py_cov_data: ~
|
48
51
|
# main scrip to run
|
49
52
|
py_main: "#{py_src_dir}/#{name}.py"
|
50
53
|
# main script arguments as a list
|
@@ -70,6 +73,9 @@
|
|
70
73
|
py_clean_files:
|
71
74
|
- "**/*.pyc"
|
72
75
|
- "**/*.pyo"
|
76
|
+
# files to exlude
|
77
|
+
py_clean_excl:
|
78
|
+
- "env/**/*"
|
73
79
|
|
74
80
|
# Build targets
|
75
81
|
- target: py_version
|
@@ -128,7 +134,8 @@
|
|
128
134
|
src: :py_src_dir
|
129
135
|
test: "#{py_test_dir}/#{py_test_files}"
|
130
136
|
dir: :py_test_dir
|
131
|
-
data: "#{
|
137
|
+
data: "#{defined?(py_cov_data) ? py_cov_data : ''}"
|
138
|
+
dest: :py_cov_dir
|
132
139
|
|
133
140
|
- target: py_run
|
134
141
|
description: Run Python script
|
@@ -142,7 +149,12 @@
|
|
142
149
|
description: Clean generated files
|
143
150
|
script:
|
144
151
|
- rmdir: :py_clean_dirs
|
145
|
-
-
|
152
|
+
- find:
|
153
|
+
root: :base
|
154
|
+
includes: :py_clean_files
|
155
|
+
excludes: :py_clean_excl
|
156
|
+
property: _clean_files
|
157
|
+
- rm: :_clean_files
|
146
158
|
|
147
159
|
- target: py_deps
|
148
160
|
description: Check Python dependencies using PIP
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bee_python
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michel Casabianca
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2014-02-17 00:00:00 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bee
|