Mercurial > hg > MakeItSo
comparison makeitso/python.py @ 242:5cb893831f53
fix for when output is not supplied
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Tue, 23 Aug 2016 15:34:27 -0700 |
parents | cab05bfc59ab |
children | fb70a9c72ec2 |
comparison
equal
deleted
inserted
replaced
241:90ecb5c015de | 242:5cb893831f53 |
---|---|
36 | 36 |
37 class Unittest(MakeItSoTemplate): | 37 class Unittest(MakeItSoTemplate): |
38 """template for python unittest""" | 38 """template for python unittest""" |
39 templates = [('python_package', 'tests', 'test_{{package}}.py')] | 39 templates = [('python_package', 'tests', 'test_{{package}}.py')] |
40 def pre(self, variables, output): | 40 def pre(self, variables, output): |
41 if 'package' not in variables: | 41 if output and 'package' not in variables: |
42 package = os.path.splitext(os.path.basename(output.rstrip(os.path.sep)))[0] | 42 package = os.path.splitext(os.path.basename(output.rstrip(os.path.sep)))[0] |
43 indicator = 'test_' | 43 indicator = 'test_' |
44 if package.startswith(indicator): | 44 if package.startswith(indicator): |
45 package = package[len(indicator):] | 45 package = package[len(indicator):] |
46 variables['package'] = package | 46 variables['package'] = package |