cleepcli 1.44.2__tar.gz → 1.45.0__tar.gz

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.
Files changed (40) hide show
  1. {cleepcli-1.44.2/cleepcli.egg-info → cleepcli-1.45.0}/PKG-INFO +1 -1
  2. {cleepcli-1.44.2 → cleepcli-1.45.0}/bin/ccli +4 -30
  3. {cleepcli-1.44.2 → cleepcli-1.45.0}/bin/cleep-cli +4 -30
  4. cleepcli-1.45.0/cleepcli/check.py +1791 -0
  5. {cleepcli-1.44.2 → cleepcli-1.45.0}/cleepcli/cleepapi.py +33 -0
  6. {cleepcli-1.44.2 → cleepcli-1.45.0}/cleepcli/file.py +40 -19
  7. {cleepcli-1.44.2 → cleepcli-1.45.0}/cleepcli/module.py +81 -61
  8. {cleepcli-1.44.2 → cleepcli-1.45.0}/cleepcli/package.py +22 -2
  9. {cleepcli-1.44.2 → cleepcli-1.45.0}/cleepcli/test.py +138 -94
  10. {cleepcli-1.44.2 → cleepcli-1.45.0}/cleepcli/version.py +1 -1
  11. {cleepcli-1.44.2 → cleepcli-1.45.0}/cleepcli/watch.py +34 -17
  12. {cleepcli-1.44.2 → cleepcli-1.45.0/cleepcli.egg-info}/PKG-INFO +1 -1
  13. {cleepcli-1.44.2 → cleepcli-1.45.0}/cleepcli.egg-info/SOURCES.txt +5 -0
  14. cleepcli-1.45.0/tests/test_check.py +132 -0
  15. cleepcli-1.45.0/tests/test_config.py +15 -0
  16. cleepcli-1.45.0/tests/test_console.py +49 -0
  17. cleepcli-1.45.0/tests/test_coverage.py +65 -0
  18. cleepcli-1.45.0/tests/test_docs_breaking.py +90 -0
  19. cleepcli-1.45.0/tests/test_module_scaffold.py +26 -0
  20. cleepcli-1.45.0/tests/test_watch.py +340 -0
  21. cleepcli-1.44.2/cleepcli/check.py +0 -1471
  22. cleepcli-1.44.2/tests/test_console.py +0 -51
  23. cleepcli-1.44.2/tests/test_watch.py +0 -314
  24. {cleepcli-1.44.2 → cleepcli-1.45.0}/LICENSE +0 -0
  25. {cleepcli-1.44.2 → cleepcli-1.45.0}/MANIFEST.in +0 -0
  26. {cleepcli-1.44.2 → cleepcli-1.45.0}/README.md +0 -0
  27. {cleepcli-1.44.2 → cleepcli-1.45.0}/cleepcli/__init__.py +0 -0
  28. {cleepcli-1.44.2 → cleepcli-1.45.0}/cleepcli/ci.py +0 -0
  29. {cleepcli-1.44.2 → cleepcli-1.45.0}/cleepcli/config.py +0 -0
  30. {cleepcli-1.44.2 → cleepcli-1.45.0}/cleepcli/console.py +0 -0
  31. {cleepcli-1.44.2 → cleepcli-1.45.0}/cleepcli/docs.py +0 -0
  32. {cleepcli-1.44.2 → cleepcli-1.45.0}/cleepcli/git.py +0 -0
  33. {cleepcli-1.44.2 → cleepcli-1.45.0}/cleepcli/tools.py +0 -0
  34. {cleepcli-1.44.2 → cleepcli-1.45.0}/cleepcli.egg-info/dependency_links.txt +0 -0
  35. {cleepcli-1.44.2 → cleepcli-1.45.0}/cleepcli.egg-info/requires.txt +0 -0
  36. {cleepcli-1.44.2 → cleepcli-1.45.0}/cleepcli.egg-info/top_level.txt +0 -0
  37. {cleepcli-1.44.2 → cleepcli-1.45.0}/pyproject.toml +0 -0
  38. {cleepcli-1.44.2 → cleepcli-1.45.0}/requirements.txt +0 -0
  39. {cleepcli-1.44.2 → cleepcli-1.45.0}/setup.cfg +0 -0
  40. {cleepcli-1.44.2 → cleepcli-1.45.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cleepcli
3
- Version: 1.44.2
3
+ Version: 1.45.0
4
4
  Summary: Cleep-cli helps developers to build great Cleep applications from command line.
5
5
  Home-page: https://github.com/CleepDevice/cleep-cli
6
6
  Author: Tanguy Bonneau
@@ -17,7 +17,7 @@ from cleepcli.git import Git
17
17
  from cleepcli.module import Module
18
18
  from cleepcli.file import File
19
19
  from cleepcli.watch import CleepWatchdog
20
- from cleepcli.test import Test
20
+ from cleepcli.test import Test, is_file_coverage_valid
21
21
  from cleepcli.package import Package
22
22
  from cleepcli.docs import Docs
23
23
  from cleepcli.check import Check
@@ -42,8 +42,6 @@ def log_root(msg, *args, **kwargs):
42
42
  logging.addLevelName(level, "TRACE")
43
43
  logging.trace = log_root
44
44
 
45
- PRAGMA_NO_COVER_PATTERN = r'#\s*pragma\s*:\s*no\s+cover'
46
-
47
45
  @click.group()
48
46
  def core():
49
47
  pass
@@ -282,7 +280,7 @@ def get_module_name(ctx, param, value):
282
280
  return module_name
283
281
 
284
282
  @mod.command()
285
- @click.option('--run-scripts', default=False, is_flag=True, help='Also run preinst.sh and postinst.sh scripts')
283
+ @click.option('--run-scripts', default=False, is_flag=True, help='Also run preinst.json and postinst.json phase manifests')
286
284
  def modssync(run_scripts):
287
285
  """
288
286
  Synchronize all mandatory modules (system, network...)
@@ -296,13 +294,13 @@ def modssync(run_scripts):
296
294
  res = f.module_sync(module, backend=False, frontend=False, scripts=True)
297
295
  if not res:
298
296
  sys.exit(1)
299
- res = f.module_run_install_script(module, "preinst.sh")
297
+ res = f.module_run_phase_manifest(module, "preinst")
300
298
  if not res:
301
299
  sys.exit(1)
302
300
  res = f.module_sync(module, backend=True, frontend=True, scripts=True)
303
301
  if not res:
304
302
  sys.exit(1)
305
- res = f.module_run_install_script(module, "postinst.sh")
303
+ res = f.module_run_phase_manifest(module, "postinst")
306
304
  if not res:
307
305
  sys.exit(1)
308
306
  else:
@@ -400,30 +398,6 @@ def modtests(ctx, module, coverage, copyto, pattern):
400
398
  if not res:
401
399
  sys.exit(1)
402
400
 
403
- def is_file_coverage_valid(coverage_info):
404
- """
405
- Check if file is not respecting Cleep test practices
406
- """
407
- if coverage_info['file'].find('__init__.py') != -1:
408
- # drop __init__.py
409
- return True
410
-
411
- if coverage_info['statements'] == 0 and coverage_info['coverage'] == 100:
412
- # no statements covered
413
- logging.error('File "%s" fully uncovered by tests' % coverage_info['file'])
414
- return False
415
-
416
- with open(coverage_info['file']) as fdesc:
417
- lines = fdesc.readlines()
418
- lines_count = len(lines)
419
- max_pragma = max(int(lines_count / 150), 1)
420
- count_pragma = len(re.findall(PRAGMA_NO_COVER_PATTERN, '\n'.join(lines)))
421
- if count_pragma > max_pragma:
422
- logging.error('Number of allowed "no cover" exceed max allowed (1 per 150 source lines) in "%s"' % coverage_info['file'])
423
- return False
424
-
425
- return True
426
-
427
401
  @test.command()
428
402
  @click.option('--module', callback=get_module_name, help='Module name.')
429
403
  @click.option('--missing', is_flag=True, help='Display missing statements.')
@@ -17,7 +17,7 @@ from cleepcli.git import Git
17
17
  from cleepcli.module import Module
18
18
  from cleepcli.file import File
19
19
  from cleepcli.watch import CleepWatchdog
20
- from cleepcli.test import Test
20
+ from cleepcli.test import Test, is_file_coverage_valid
21
21
  from cleepcli.package import Package
22
22
  from cleepcli.docs import Docs
23
23
  from cleepcli.check import Check
@@ -42,8 +42,6 @@ def log_root(msg, *args, **kwargs):
42
42
  logging.addLevelName(level, "TRACE")
43
43
  logging.trace = log_root
44
44
 
45
- PRAGMA_NO_COVER_PATTERN = r'#\s*pragma\s*:\s*no\s+cover'
46
-
47
45
  @click.group()
48
46
  def core():
49
47
  pass
@@ -282,7 +280,7 @@ def get_module_name(ctx, param, value):
282
280
  return module_name
283
281
 
284
282
  @mod.command()
285
- @click.option('--run-scripts', default=False, is_flag=True, help='Also run preinst.sh and postinst.sh scripts')
283
+ @click.option('--run-scripts', default=False, is_flag=True, help='Also run preinst.json and postinst.json phase manifests')
286
284
  def modssync(run_scripts):
287
285
  """
288
286
  Synchronize all mandatory modules (system, network...)
@@ -296,13 +294,13 @@ def modssync(run_scripts):
296
294
  res = f.module_sync(module, backend=False, frontend=False, scripts=True)
297
295
  if not res:
298
296
  sys.exit(1)
299
- res = f.module_run_install_script(module, "preinst.sh")
297
+ res = f.module_run_phase_manifest(module, "preinst")
300
298
  if not res:
301
299
  sys.exit(1)
302
300
  res = f.module_sync(module, backend=True, frontend=True, scripts=True)
303
301
  if not res:
304
302
  sys.exit(1)
305
- res = f.module_run_install_script(module, "postinst.sh")
303
+ res = f.module_run_phase_manifest(module, "postinst")
306
304
  if not res:
307
305
  sys.exit(1)
308
306
  else:
@@ -400,30 +398,6 @@ def modtests(ctx, module, coverage, copyto, pattern):
400
398
  if not res:
401
399
  sys.exit(1)
402
400
 
403
- def is_file_coverage_valid(coverage_info):
404
- """
405
- Check if file is not respecting Cleep test practices
406
- """
407
- if coverage_info['file'].find('__init__.py') != -1:
408
- # drop __init__.py
409
- return True
410
-
411
- if coverage_info['statements'] == 0 and coverage_info['coverage'] == 100:
412
- # no statements covered
413
- logging.error('File "%s" fully uncovered by tests' % coverage_info['file'])
414
- return False
415
-
416
- with open(coverage_info['file']) as fdesc:
417
- lines = fdesc.readlines()
418
- lines_count = len(lines)
419
- max_pragma = max(int(lines_count / 150), 1)
420
- count_pragma = len(re.findall(PRAGMA_NO_COVER_PATTERN, '\n'.join(lines)))
421
- if count_pragma > max_pragma:
422
- logging.error('Number of allowed "no cover" exceed max allowed (1 per 150 source lines) in "%s"' % coverage_info['file'])
423
- return False
424
-
425
- return True
426
-
427
401
  @test.command()
428
402
  @click.option('--module', callback=get_module_name, help='Module name.')
429
403
  @click.option('--missing', is_flag=True, help='Display missing statements.')