wrapper: normalize dashes to underscores
This will allow us to have `cros-workon` as a program with the
underlying module still names "cros_workon.py". The wrapper
today already supports "cros-workon.py", but we don't want to
rename modules, or use dashes in them in general as it makes
it a lot harder to import.
BUG=b:187792699
TEST=`cros-workon --help` passes
Change-Id: I3f2aaae1ea89534cd2db32305b216f513f35b96c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2975662
Reviewed-by: Alex Klein <saklein@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/wrapper3_unittest.py b/scripts/wrapper3_unittest.py
index af845eb..6237773 100644
--- a/scripts/wrapper3_unittest.py
+++ b/scripts/wrapper3_unittest.py
@@ -179,3 +179,11 @@
# Script has syntax errors and cannot be imported.
prog.with_suffix('.py').write_text('}')
self._run_tests(prog, verify=verify, check=False)
+
+ def testDashes(self):
+ """Check behavior of scripts with dashes in their names."""
+ script = self.chromite_dir / 'scripts' / 'p_r_o_g'
+ self.gen_script(script)
+ prog = self.chromite_dir / 'bin' / 'p-r-o-g'
+ prog.symlink_to(self.wrapper)
+ self._run_tests(prog)