Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issues #150, #151, #156 and #160 #153

Merged
merged 6 commits into from
Aug 2, 2015

Conversation

arcivanov
Copy link
Member

Forking option in coverage and unittest is now deprecated (removed in unittest since never made public)
Coverage will always fork
Unittest will always fork unless is already forked in coverage
utils.fork_process is now used in both to capture exit code, returned value and possible exception (with traceback) from a forked process
Module reloading is removed since it doesn't ever work when modules keep state and rely on intermodule dependencies
This should be a problem since coverage and unittests run in different forks and will reinitialize the modules anyway

Closes #150, closes #151

@arcivanov
Copy link
Member Author

ionelmc/python-tblib#7 fixed that should deal with 2.6 compatibility once accepted

@arcivanov
Copy link
Member Author

You're absolutely correct, let me fix this.

@arcivanov
Copy link
Member Author

Is it a first runtime dependency or I'm missing something? @mriehl

@mriehl
Copy link
Member

mriehl commented Jul 27, 2015

Well it's required if someone pip installs pybuilder, so it should be runtime.
PR looks good, do you want to merge and release it? I can grand you write access on PyPI if you want to do it.

@arcivanov
Copy link
Member Author

I think merge is fine and I think we can release this, although I'm thinking of at least a couple more improvements (fairly minor) at this point. If you grant me PyPi access it would be great as well!

@mriehl
Copy link
Member

mriehl commented Jul 27, 2015

I'll need your PyPI user name to grant you permissions - you can send it via email if you don't want to disclose it publicly.

@arcivanov
Copy link
Member Author

It's the same - arcivanov. Thanks!

@mriehl
Copy link
Member

mriehl commented Jul 27, 2015

Right, thanks! Should work now.

@arcivanov
Copy link
Member Author

@mriehl @locolupo this is done and ready for review. See commends in #156.

@arcivanov arcivanov changed the title Fixes issues #150 and #151 Fixes issues #150, #151 and #156 Jul 30, 2015
Forking option in coverage and unittest is now deprecated (removed in unittest since never made public)
Coverage will always fork
Unittest will always fork unless is already forked in coverage
utils.fork_process is now used in both to capture exit code, returned value and possible exception (with traceback) from a forked process
Module reloading is removed since it doesn't ever work when modules keep state and rely on intermodule dependencies
This should be a problem since coverage and unittests run in different forks and will reinitialize the modules anyway

Closes pybuilder#150, closes pybuilder#151
@@ -56,12 +54,14 @@ def __init__(self, first, second=None):
CircularTaskDependencyException, self).__init__("Circular task dependency detected between %s and %s",
first,
second)
else:
super(CircularTaskDependencyException, self).__init__(first)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this required? e.G. how can we have a cycle but only one node is known?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By not calling an init we don't call a super into exceptions. This makes the exception unpicklable.

PS: Python serialization sucks worse than Java 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reworked this block

@mriehl
Copy link
Member

mriehl commented Jul 31, 2015

There's a problem when building a new project (pyb --start-project and accept all defaults) without sources or tests:

PyBuilder version 0.10.63
Build started at 2015-07-31 09:15:06
------------------------------------------------------------
[INFO]  Building tmp version 1.0.dev0
[INFO]  Executing build in /tmp
[INFO]  Going to execute task publish
[INFO]  Running unit tests
[INFO]  Executing unit tests from Python modules in /tmp/src/unittest/python
[WARN]  No unit tests executed.
[INFO]  All unit tests passed.
[INFO]  Building distribution in /tmp/target/dist/tmp-1.0.dev0
[INFO]  Copying scripts to /tmp/target/dist/tmp-1.0.dev0/scripts
[INFO]  Writing setup.py as /tmp/target/dist/tmp-1.0.dev0/setup.py
[INFO]  Collecting coverage information
[INFO]  Running unit tests
[INFO]  Executing unit tests from Python modules in /tmp/src/unittest/python
[WARN]  No unit tests executed.
[INFO]  All unit tests passed.
[WARN]  Overall coverage is below 70%:  0%
Coverage.py warning: No data was collected.
Traceback (most recent call last):
  File "/usr/lib/python2.7/multiprocessing/queues.py", line 264, in _feed
    send(obj)
PicklingError: Can't pickle <class 'pybuilder.errors.BuildFailedException'>: it's not the same object as pybuilder.errors.BuildFailedException

Looks like some reimport related problem with pickling being too picky about types when adding errors to the queue.

Also note the build hangs afterwards due to the process not terminating normally - we need to fix this before pushing out a release.

@mriehl
Copy link
Member

mriehl commented Jul 31, 2015

Code LGTM aside from the comment above.

This contribution is fantastic - thank you. I never gave it much thought before you brought up the issue but of course self-bootstrapping while running coverage is totally nontrivial...

@arcivanov
Copy link
Member Author

@mriehl Thanks for tracking down pyb --start-project - I reworked the fork exception handling logic.

@arcivanov arcivanov force-pushed the issue_150_151 branch 5 times, most recently from 63bc4f5 to 920abf1 Compare August 1, 2015 14:21
Fix "syntax error/compile" warning
Rework message queue mechanism in forking making it more robust
Cover the new exception handling in forking with more tests
@arcivanov arcivanov force-pushed the issue_150_151 branch 3 times, most recently from 41f0662 to 8b02606 Compare August 2, 2015 02:28
@arcivanov arcivanov changed the title Fixes issues #150, #151 and #156 Fixes issues #150, #151, #156 and #160 Aug 2, 2015
branch tracking is added
html report generation is added in $dir_reports/<execution_prefix>_html/
modules to be covered are explicitly passed to report generator
ensure modules have no duplicates
@arcivanov
Copy link
Member Author

@mriehl I added the #160. If you could perform the final review so that I can merge it would be great.

@mriehl
Copy link
Member

mriehl commented Aug 2, 2015

I think it's good to go, LGTM!

@arcivanov
Copy link
Member Author

Super, thanks!

arcivanov added a commit that referenced this pull request Aug 2, 2015
@arcivanov arcivanov merged commit 7b09367 into pybuilder:master Aug 2, 2015
@arcivanov arcivanov removed the ready label Aug 2, 2015
@coveralls
Copy link

Coverage Status

Coverage increased (+27.1%) to 100.0% when pulling ab6488f on arcivanov:issue_150_151 into c9ecba2 on pybuilder:master.

@arcivanov arcivanov deleted the issue_150_151 branch April 27, 2017 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants