-
-
Notifications
You must be signed in to change notification settings - Fork 763
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
config option to specify profile example count #747
Conversation
@greggroth almost all of the |
I actually think this makes sense NOT having a command line option, the reasoning being that it depends on another option being set. |
@soulcutter |
@soulcutter I think it's more common to use How about, instead of adding a separate option, we allow
And in RSpec.configure {|c| c.profile_examples = 200} |
@greggroth That's not too bad, I guess. I guess I was worried more about something like @dchelimsky You're right :) |
@dchelimsky I hadn't thought of it like that. Changing |
@greggroth yes. |
👍 I'm on it. |
describe "something" do | ||
it "foos take longest" do | ||
container = Array.new | ||
100_000.times { |n| container << n } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to see an explicit slowdown (e.g. using sleep
) rather than an implicit one using a loop like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure if sleep
would be a problem since it would slow down the test suite. I'll give it a shot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing something 100,000 times slows down the test suite, too. sleep
is just less obtuse and more explicit.
Just make sure to use a low value (e.g. sleep 0.1
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not to mention the memory... good catch
Can one of you check out the above two commits and let me know if I went about it the right way? Thanks! |
I'm also aware of the test failures and I'm looking into those now. |
it "eleventh example" do | ||
sleep 0.05 | ||
11.should == 11 | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a little confusing that you've got some examples named "foos/bazzes/bars take X" and others are named "nth example". It'd be nice to have a consistent naming scheme here. Maybe something like it "sleeps for X seconds (example #Y)"
? (where X and Y would be filled in for the specific example)
This is looking good. One general question: should setting
For me personally, my workflow is more in line with the first: in my minute-by-minute TDD cycle, I run individual spec files one-off, and I don't want the profile output for that. Once I'm ready to commit and/or push, I run the entire suite, and I do want the profile output then. I kinda wonder if those semantics would be confusing, though, so it might be better to stick with the second. @sferik -- I'm curious on your thoughts here, given that you were the original requestor of this feature. |
* fix fragile spec which depends on line distance from where the spec is defined.
I'm typically in one of three modes when doing software development:
I use a different set of tools and flags in each of these modes. For example, I typically (Normal Mode) run I also typically (Normal Mode) run specs with the This is a long way of saying, I'd like it to be easy for me to switch between these different modes. In my opinion, setting |
I agree with @sferik. I like the idea of a |
Sounds good. |
@myronmarston this is ready for review when you have a chance. Thanks! |
@@ -506,6 +508,19 @@ def reporter | |||
end | |||
end | |||
|
|||
# @api private | |||
# | |||
# Defaults `profile_examples` to 10 examples when `@profile_exmaples` is `true`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/exmaples/examples/
@greggroth -- thanks for letting me know. I left a couple more comments. |
@greggroth -- do you want to take care of addressing my last couple comments before I merge? I can certainly take care of them but I always like to give the chance to contributors to address things first. |
I'll take care of this tomorrow. Sorry I've been slow -- holidays and all. ;-) Thanks! On Sunday, December 23, 2012 at 8:06 PM, Myron Marston wrote:
|
Sorry for the delay. Those two commits should address all of your comments. |
config option to specify profile example count
Thanks @greggroth -- this looks great. And no need to apologize...you do this in your free time like the rest of us :). |
This adds a configuration option to specify the number of examples to include in the profile output.
addresses #726