Skip to content

Commit

Permalink
add .gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] authored and [email protected] committed Aug 17, 2021
1 parent 9b65c7f commit 7ef0521
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 6 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ commit: test lint
.PHONY: clean
clean:
rm -rf build __pycache__ test_actual/
$(foreach DIR, $(wildcard test_expected/*),$(MAKE) -C $(DIR) clean &&) :


.PHONY: superclean
Expand Down
7 changes: 7 additions & 0 deletions template/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/.coverage
/Makefile.base
/build/
/dist/
/pylintrc
/src/*.egg-info/
__pycache__/
7 changes: 7 additions & 0 deletions test_expected/test_nodoc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/.coverage
/Makefile.base
/build/
/dist/
/pylintrc
/src/*.egg-info/
__pycache__/
7 changes: 7 additions & 0 deletions test_expected/test_nodoc_nomain/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/.coverage
/Makefile.base
/build/
/dist/
/pylintrc
/src/*.egg-info/
__pycache__/
7 changes: 7 additions & 0 deletions test_expected/test_nomain/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/.coverage
/Makefile.base
/build/
/dist/
/pylintrc
/src/*.egg-info/
__pycache__/
7 changes: 7 additions & 0 deletions test_expected/test_required/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/.coverage
/Makefile.base
/build/
/dist/
/pylintrc
/src/*.egg-info/
__pycache__/
22 changes: 16 additions & 6 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,19 @@

class PythonPackageTemplateTest(unittest.TestCase):

LEFT_ONLY_EXCLUDE = ['.coverage', 'Makefile.base', 'build', 'pylintrc']
LEFT_ONLY_EXCLUDE_EXT = ['.egg-info']

def assert_dcmp(self, dcmp):
self.assertListEqual(dcmp.diff_files, [])
self.assertListEqual(dcmp.left_only, [])
self.assertListEqual(
[
file_ for file_ in dcmp.left_only if
(file_ not in self.LEFT_ONLY_EXCLUDE and
not any(file_.endswith(ext) for ext in self.LEFT_ONLY_EXCLUDE_EXT))
],
[]
)
self.assertListEqual(dcmp.right_only, [])
for subdir_dcmp in dcmp.subdirs.values():
self.assert_dcmp(subdir_dcmp)
Expand All @@ -29,26 +39,26 @@ def _test_template(self, test_name, template_args, no_compile=False):
shutil.rmtree(actual_dir)

# Render the template
output = subprocess.check_output(
render_output = subprocess.check_output(
['build/venv/bin/template-specialize', 'template/', actual_dir, *template_args],
env={},
stderr=subprocess.STDOUT,
encoding='utf-8'
)
self.assertEqual(output, '')
self.assertEqual(render_output, '')

# Compare the rendered template to the expected
self.assert_dcmp(filecmp.dircmp(expected_dir, actual_dir))

# Run "make commit" on rendered template
if not no_compile:
actual_make = subprocess.check_output(
['make', '-C', actual_dir, 'commit'],
compile_output = subprocess.check_output(
['make', '-C', expected_dir, 'commit'],
env={'PATH': os.getenv('PATH')},
stderr=subprocess.STDOUT,
encoding='utf-8'
)
self.assertNotEqual(actual_make, '')
self.assertNotEqual(compile_output, '')

# Delete the actual directory
shutil.rmtree(actual_dir)
Expand Down

0 comments on commit 7ef0521

Please sign in to comment.