Closed Bug 568998 Opened 14 years ago Closed 13 years ago

separate mozmill and restart into different files

Categories

(Testing Graveyard :: Mozmill, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: harth, Assigned: harth)

References

Details

(Whiteboard: [mozmill-2.0-])

Whenever I work on Mozmill, I'm always accidentally editing methods in MozMillRestart class instead of MozmMill or vice versa because they're so similar, we should separate these, and put them in different files, importing both from __init__.py
Jeff, does it work for you? Given your own work we will end-up in 4 different files, is that correct?

mozmill.py
restart.py
mozmill-cli.py (or similar)
restart-cli.py (or similar)
Assignee: nobody → harthur
Status: NEW → ASSIGNED
(In reply to comment #2)
> Jeff, does it work for you? Given your own work we will end-up in 4 different
> files, is that correct?
> 
> mozmill.py
> restart.py
> mozmill-cli.py (or similar)
> restart-cli.py (or similar)

I would like a level of separation with at least one more file, e.g.

mozmill.py
restart.py
firefox_cli.py
firefox_restart_cli.py
thunderbird_cli.py

I don't really care about the names, but it's important to use underscores instead of dashes, as the latter will be a python syntax error when trying to import them (in general, dashes should be avoided for python scripts, except generated command line entry-points).

Having each command-line interface in a separate file allows the scripts to be easily run packaged or unpackaged.  I.e. each file has a `main` function (or whatever, we call it cli and variations thereof here) and you have a shebang at the top `#!/usr/bin/env python` and at the bottom you have 

if __name__ == '__main__':
  main()

Since it is unknown going forward whether mozmill will be run packaged (e.g. after running setup.py and invoking setuptools) or unpackaged (via running, e.g. `python mozmill_cli.py`), separation give us (and everyone else) the freedom to run unpackaged.  We also use local references to find resources (e.g. os.path.abspath(os.path.dirname(__file__))) vs setuptools pkg_resources.  Normally, I would call this undesirable (as, for reasons I don't understand, people like to install packages in zipped eggs...never understood why, and our method won't work there), but it does allow us to run unpackaged so in this case I'm for it.  The only barrier is having one file per command line script.
Whiteboard: [mozmill-2.0?]
possibly worth seeing the patch on duplicae bug 562473
Depends on: 584464
once bug 584464 lands, this is no longer an issue.

--> WONTFIX
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → WONTFIX
Whiteboard: [mozmill-2.0?] → [mozmill-2.0-]
Product: Testing → Testing Graveyard
You need to log in before you can comment on or make changes to this bug.