Yeah I really don't like to type full names out, for the fear of mistyping a letter and disrespecting the person's name :\ So short forms = less chance I suppose
So this is the default behavior when you give a bad variable name:
>>> foo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'foo' is not defined
>>>
what I'm looking for is something like:
>>> set_name_error_handling('assign_default',None)
>>> foo
>>>
...
@KevinMGranger given the number of people on the planet - you're going to find life extremely difficult if you need to clarify who you mean by excluding everyone else known :)
can anyone recommend a good tool for writing python integration tests ?
I usually just use py.test and mark my tests as test_01, test_02, etc., to get them to run in the specified order, but I'm wondering if there are any alternatives/better ways...
How do y'all integrate testing into your workflow? In particular I'm interested in when and how testing first becomes part of one's project. Like, do you start writing tests five minutes before you put down your first line of code? Or do you reach a critical mass of complexity and say "I guess this has become big enough to warrant testing"? Or what?
@Jfach: no. I mock and patch as needed to limit dependencies, and if I absolutely need a few things to happen in a given order, then I put them in said order within a function.
So, that's a bit of a tough one to answer. I always try to jump to writing a test first, however depending on complexity I try to work out things with how my brain wants to.
i.e. If I am starting a project from scratch, I start with at least a project skeleton, and a quick integration test to make sure things are wired. e.g. API I'm building.
@Kevin: depends on the task. I don't do strict TDD at the "middle" layers of a project, because that's where things change the most rapidly and I don't want to overarchitect.
If I am adding features to an existing project, I first analyze the code base by reading the tests, looking at where my solution works....what I do sometimes is deliberately break the test
to see what my changes will bring to the system
and then I start working back and forth between tests and real-code
I've trained myself to respect and love the testing process and find it a critical part of my software development process.
@poke it also breaks copy-paste in my firefox somehow, I need to first paste to a text editor and then copy-paste from there into slack, and even then newlines are removed
@DSM That makes sense to me. It seems to me that the requirements for a project are fuzziest at the center, so that's where it's most difficult to write tests that verify requirements are being satisfied.
@AndrasDeak I will myself to learn numpy and pyTest every weekend. My way never leads me to either goals. I guess that statement should have provided a quantity of will as a requirement. Time to send back to business team.
@idjaw One of the upvoted answers is about the API (which syntax doesn’t work on the client) and the other answer says it doesn’t work, which is true.
"center" both in terms of temporally and architecturally. When you begin writing a project, you can bang out the parts that have coalesced most sharply in your mind, and only later encounter the bits you glossed over in your initial brainstorm. At the end of a project, you've necessarily nailed down those bits, or else you wouldn't be at the end of your project.
When you're writing the low-level bits of your project that interface with external APIs and such, you have a good idea of how you ought to interface with them, because the APIs are hopefully already well-documented and consistent. And the user-facing bits aren't too bad if you know what you want your project to actually do. But there's a combinatorially huge number of ways to tie the low level into the high level.
Not sure if this is related to the problem, but the line for i, bb in enumerate(bbs): is indented with a tab while every other line is indented with spaces.
I think in this context the tab is not actively harmful since it evaluates to the intended indentation level anyway, but it should still be replaced with spaces on principle
@AndrasDeak ok I found it... :) I double checked the variable in question. I think that it is due to the fact that pressing a key triggers a bunch of complex functions, some of those keyporesses are then buffered in the meantime that the function finishes its execution
I didn't ping you directly because I figured talking about frames would be enough of an indication, since none of the other conversations going on had anything to do with frames
I've come to the conclusion that, in a medium with multiple overlapping conversations, identifying which messages belong to the conversation you care about is an acquired skill
I'm pretty rubbish at it in real life. Once more than two people in a room are talking, it's all just static to me. It's much easier in textual mediums
Yeah. My expectation is that the expense of moving around frame data and result data between processes will be dwarfed by the gain in efficiency of the analysis
@davidism Yes, but that's not where the problem is? As I see it, the problem is that tokenize from the stdlib is trying to import token from the stdlib, but it's importing the OP's token.py instead
It's unclear to me whether you're agreeing with me or not because you said it will take too much time, then I said that it wouldn't take too much time, then you agreed with me, then you petitioned the room for general ideas to improve your code. If you really agreed with me, you wouldn't need tips, you could move forward with the multiprocessing plan on your own. But in any case, I don't have anything further to add since I don't have all that much practical experience with multiprocessing
@Kevin What I meant based on how I interpeted your message: Yes I agree on the fact that moving the passing from one process to another may cause too much of an overhead. Which is why multiprocessing may not be the best solution for real-time applications
Maybe "X is dwarfed by Y" is a confusing phrasing. I meant that X is considerably smaller than Y. In other words, the overhead of interprocess communication is small compared to the time you save.
... Theoretically. Only benchmarking the different approaches can prove it for certain.
oh goodness...plugin manager I'm using is using setup.py to load all its references. For my testing I want to get it to point to a bogus test class instead of going to the "real" thing
once I find a way that is "oh that was easy". I'm sure that was the right now. But the fact that I'm looking through this package to find the point it loads the setup.py stuff and I want to inject my stuff...it doesn't feel right
Except perhaps when you bootstrap a compiler with a hidden payload in the binary that propagates itself into executables it creates if it detects it's compiling a new version of itself
I can't take credit for the idea since I read about the theory in an article written by some security industry hotshot, which I unfortunately can't find right now
and so concludes my journey for injecting my change....it requires actually playing with entry_points.txt which I'm going to refrain from doing and conclude that this test is good enough.
How do I daemonize Bottle app properly? I have no root and sudo access, and yeah I have tried BottleDaemon, it doesn't work with bottle.run() arguments
well now I'm curious about something when it comes to this testing of things that depend on entry points
and my debate with myself is on practice and separation of concern
Now. The tools I am using are tested on their own right. So I should not have to test their functionality. But, if I want to test my factory to ensure things are loaded properly
I thought it would be nice to say "here is my bogus entry point" and "here is a bogus class this entry point points to"....now kiss
it seems to me I should mock out all things around that, and return back my "expected result" instead.
to remove all that noise of wanting to do this funny injection.
yes...I think that would be the correct approach here.
How do I daemonize Bottle app properly? I have no root and sudo access, and yeah I have tried BottleDaemon, it doesn't support server argument. supervisor throws permission denied errors on subprocess.Popen, and this only occurs if I try to start my Bottle app via supervisor.