Skip to content

Commit

Permalink
Add __init__.py to packages.
Browse files Browse the repository at this point in the history
This is required for my particular use case -- running pytest on the
generated code directory -- due to
<pytest-dev/pytest#774>. It ought to be
abstracted out, especially if we ever support non-python code blocks.
  • Loading branch information
ryneeverett committed Jan 5, 2016
1 parent db10a51 commit 17d6208
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mkcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ def main(inputs, output, github, safe):
outputdir = os.path.dirname(outputfilename)
if not os.path.exists(outputdir):
os.makedirs(outputdir)
with open(os.path.join(outputdir, '__init__.py'), 'w'):
pass

with open(outputfilename, 'w') as outputfile:
outputfile.write(code)

0 comments on commit 17d6208

Please sign in to comment.