Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

Refactor setup module starting#913

Closed
hamiltont wants to merge 16 commits intoTechEmpower:masterfrom
hamiltont:refactor_setup
Closed

Refactor setup module starting#913
hamiltont wants to merge 16 commits intoTechEmpower:masterfrom
hamiltont:refactor_setup

Conversation

@hamiltont
Copy link
Copy Markdown
Contributor

This is a work-in-progress PR. If you like the approach I'll apply this to the current setup files.

This enables much cleaner setup.py files, and makes debugging much easier by logging each shell command from a setup.py before it is run. It's basically two minor changes:

  • Pass setup_module it's decorator framework_test instead of benchmarker (why did we ever do this anyways?!)
  • Use fw_test to run shell scripts to remove redundancy

Gives nicer output in log:

  Starting activeweb
-----------------------------------------------------
RUN: mvn clean  package (cwd=activeweb)
[INFO] Scanning for projects...
<snip>
RUN: $RESIN_HOME/bin/resinctl start
Resin/4.0.36 launching watchdog at 127.0.0.1:6600

TODO: Merge in ideas from https://gist.github.com/methane/a8c794c301b61fbdb356

hamiltont added 16 commits July 18, 2014 00:55
This lets the handlers set their own levels. Otherwise all
handlers are limited to the messages that the root logger
is willing to pass to them (e.g. they only get messages that
pass root logger's level setting)
Instead of opening a file handler, just use the logging framework.
In addition to the normal StreamHandler, register a FileHandler to
save a log file from running each test.

The setup.py files depend on out and err file objects, so we fake
them with a new class WrapLogger. This allows us to see real-time
output from those files as well. It is also easier for the setup.py
files as they use subprocess heavily, and it uses parameters for
errfile and outfile
- Adds a default StreamHandler inside of __run_test that can
be used to send unformatted output to stdout. This basically
emulates 'print' while allowing the messages to also be
logged into the FileHandler
- Docs at top of FrameworkTest
- Removes some extra calls to basicConfig
- Refines WrapLogger to support all log levels
- Adds utils.py file to store usefulties
Our usage of textwrap was causing extra newlines
at the prefix and suffix of each message. This fixes
that issue and cleans up the codebase a bit
Changes this poor output:
   benchmarker : INFO     --------------------------------------------------------------------------------
      Starting go
   --------------------------------------------------------------------------------
Into this better output:
   benchmarker : INFO
   --------------------------------------------------------------------------------
      Starting go
   --------------------------------------------------------------------------------
This enables much cleaner setup.py files and makes
debugging easier by logging each shell command from
setup.py before it is run.

- Pass setup_module it's decorator framework_test
- Use fw_test to run shell scripts
Uses helper thread to automatically keep track of
subprocess.Popen output
@hamiltont
Copy link
Copy Markdown
Contributor Author

Closing until this is more polished

@hamiltont hamiltont closed this Jul 18, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant