bee_python 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README +1 -1
  3. data/lib/bee_task_python.rb +37 -21
  4. data/python.yml +15 -3
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7bb9e26f6b4cbe70cdcf5606e0c5786f0bd25856
4
- data.tar.gz: fa9f05a6340b9dc60c08a686437ca1134c46d014
3
+ metadata.gz: 819f69e52e0d7f7071d5c620eb2197c157de2d23
4
+ data.tar.gz: 476fd8ad20f33d803a0406619fbfc0f98b6cbf11
5
5
  SHA512:
6
- metadata.gz: 21d76bc39e57a3e5d40a6b0963a26d058ef5e9c2aae618734386d8aabc2aabb4a716baf4712f598cf075a3cc0bb5f9c55e4d2135fcf8ea72972d74bdb3826a68
7
- data.tar.gz: a9a82265c5c79f3741717cf6b955fde6528394f3596ab7c6d20c56d0635b182fcf7f2338d94bd743f4d049b2861c26ff9d54a2226647966a6ce9ecff9b63a0ab
6
+ metadata.gz: af3177ae7c6b3eccf9de70c5c4a62b6c3ac02a0937eef63edab42922cf9dd8c0ecf117d01963135d90413665b4ab4cfcb84fd959cc11a05d1572f289793328e6
7
+ data.tar.gz: 9b119ecdfddfe6b33a6258b28fb021f35c30db6dc91eb5ac652c6c52160c9f23eb5027b305561bc2fc537ba0dec95f1d2362f6c8747e693bfa781773cbe411a7
data/README CHANGED
@@ -20,4 +20,4 @@ or go to URL http://www.apache.org/licenses/LICENSE-2.0).
20
20
 
21
21
  = Copyright
22
22
 
23
- Bee_python version 0.2.2 (C) Michel Casabianca - 2008-2010
23
+ Bee_python version 0.2.3 (C) Michel Casabianca - 2008-2010
@@ -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 = File.expand_path(params[:data] || '.coverage')
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
- for test_file in test_files
357
- begin
358
- Dir.chdir(dir)
359
- command = "coverage -x -f #{data} #{test_file}"
360
- puts "Running command: '#{command}'" if @verbose
361
- system(command) || error("Error running coverage report")
362
- ensure
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
- end
366
- if dest
367
- command = "coverage -r -f #{data} -m #{sources} > #{report}"
368
- system(command) || error("Error generating coverage report")
369
- command = "coverage -a -f #{data} -d #{dest} #{sources}"
370
- puts "Running command: '#{command}'" if @verbose
371
- system(command) || error("Error generating coverage report")
372
- else
373
- command = "coverage -r -f #{data} -m #{sources}"
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: "#{py_build_dir}/.coverage"
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
- - rm: :py_clean_files
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.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: 2013-10-15 00:00:00 Z
12
+ date: 2014-02-17 00:00:00 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bee