Skip to content

Commit

Permalink
Unit test friendly folder structure for Python examples (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
sea-bass authored Jan 13, 2025
1 parent c9f936d commit 739dfcb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Empty file.
12 changes: 12 additions & 0 deletions example_python/test/test_load_modules.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
import generate_parameter_module_example

print(f'Imported module from: {generate_parameter_module_example.__file__}')

import generate_parameter_module_example.admittance_parameters # noqa: E402

print('Imported generated parameter module')

import generate_parameter_module_example.minimal_publisher # noqa: E402

print('Imported minimal publisher module')
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ def run(output_file, yaml_file, validation_module=''):
with open(output_file, 'w') as f:
f.write(code)

# Put an __init__.py file if one does not yet exist.
init_file = os.path.join(os.path.dirname(output_file), '__init__.py')
open(init_file, 'a').close()


def parse_args():
parser = argparse.ArgumentParser()
Expand Down

0 comments on commit 739dfcb

Please # to comment.