Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upIssue with betamax not recording requests within unconsumed generators #131
Comments
So the problem is that Betamax replaces the original
I wouldn't call it "stupid mistake". I'd label it "common missteps".
I'm not sure what "it" is here. |
Of course not, but I could imagine that a global config option, that adds verbosity to betamax so that within a test context, more output could be thrown at the user:
maybe would it be possible to catch
it is just as an issue in the tracker. |
That's not possible without looking at sys.argv directly and having to check for both py.test and the verbose options (which is kind of gross). Further, Betamax aims to be test framework independent. We ship a pytest fixture, but we also ship fixtures for other popular testing frameworks too. I'm asking in |
|
@hroncok for what it's worth, I never received any help in |
|
Let's document this then. "Common mistakes" section sounds great. @guyzmo are you willing to send a PR? |
|
I can do that, though please point me out which file and where you want the section to be included (basically a |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

cf sigmavirus24/github3.py#679
tl;dr
I have setup tests with helpers such as:
in the example above, I'm returning a generator from the helper method. So when in the test I'm transforming it into a list, the iterator runs the generator AFTER the
with statementhas been exited.The fix is simply to run the generator within the
withblock context.possible actions
- keep it as is for future readers
- make it as part of a "stupid mistake" FAQ?
- add some parameter to betamax to help debug that class of mistakes faster
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/41524048-issue-with-betamax-not-recording-requests-within-unconsumed-generators?utm_campaign=plugin&utm_content=tracker%2F198445&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F198445&utm_medium=issues&utm_source=github).