/srv/irclogs.ubuntu.com/2010/08/15/#bzr.txt

=== parthm_ is now known as parthm
parthmhello. whats a good way to capture stdout/stderr in a bzr unittest. i have a unit test that prints ui.ui_factory.show_warning. i want to assertContainsRe that the output has this warning.06:09
parthmnevermind. found an example in tests\test_http.py06:47
lifelessparthm: uhm, don't do it ?06:49
lifelessparthm: capturing stdout/stderr is pretty evil and makes it very hard to debug things. Why do you want to do that ?06:49
parthmlifeless: i have a fix for bug #430785 which prints a warning in case clean-tree cannot delete a file.06:50
ubot5Launchpad bug 430785 in Bazaar "bzr clean-tree --force --detritus stops on io error (file in use) (affected: 1, heat: 6)" [Medium,Confirmed] https://launchpad.net/bugs/43078506:50
parthmui.ui_factory.show_warning ... so i am writing a unit test to verify it.06:50
lifelessparthm: I don't see why that implies capturing stdout/stderr06:50
parthmlifeless: is there any other way of ensuring that the warning is being printed?06:51
parthmor generated.06:51
lifelessuse a known api and confirm that the api is claled06:51
lifelessin this particular case, the test UI should accumulate the api calls made on it06:52
lifelessso you can just assert that show_warning was called06:52
lifelessalso06:52
lifeless  """Show warning for errors seen by rmtree.06:52
lifeless 98        """06:52
lifelessone line for one-liners please06:52
lifeless"""Show warning for errors seen by rmtree."""06:53
parthmlifeless: ah. good idea. so i can overrideAttr show_warning. i will do that.06:53
lifelesshuh06:53
lifelessno06:53
lifelessthere is a test specific UI06:53
lifelessit gathers things into strings06:54
parthmlifeless: is there any test case i can look at as an example?06:54
lifelesshmm, its changed, I could swear we used to have one06:55
lifelessanyhow, bzrlib.ui contains SilentUIFactory06:56
lifelessah06:56
lifelessits in bzrlib.tests06:56
lifelessbzrlib.tests.TestUIFactory06:56
lifelessit needs a small tweak to have a show_warning06:56
lifelessbut even without it06:57
lifelessdef test_clean_tree_warning(self):06:57
lifeless    out = String()06:58
* parthm greps for TestUIFactory usage06:58
lifeless    self.overrideAttr(ui, 'ui_factory', tests.TestUIFactory(stdout=out))06:59
lifeless    clean_tree(...)06:59
lifeless    self.assertContainsRe('needle', out.getvalue())06:59
lifeless# this should do for now, we should make it better and more structured though06:59
parthmlifeless: yes. thats the example i found in tests/test_http.py. i will implement this. i agree. confirming that the api is called would be nicer.07:00
parthmlifeless: thanks.07:01
lifelessparthm: ah, I thought you found something using apply_redirected07:01
lifelesswhich is really quite different :)07:02
lifelessbecaues *that* does alter stdout/stderr/stdin its very hard to debug within it.07:02
parthmlifeless: :) ... no it was test_http. ... test_prompt_for_username07:02
kyanIs there any way to upload files to Launchpad using a web interface, as an alternative to a command-line interface? I'm new to Bazaar/version control software, and have been unable to learn, despite some struggling — it seems to require Mac OS 10.5 (I have 10.4). Thanks!07:06
kyanI looked at macports but it needs admin access.07:06
kyanI don't have it.07:06
kyanAdmin access, that is.07:07
kyanThis is one of many reasons I hate mac os: software is next to nonexistant for it.07:08
kyan:-p07:08
lifelessbai ?07:10
lifelessspiv: btw07:11
lifelessspiv: I wish there was a pypi operationswithcleanups BSD module. Just saying.07:11
lifelessspiv: http://twitter.com/rbtcollins/status/21218747637 is why10:17
lvhHey16:57
lvhIf I have questions about using bzr with VC (the version control system in emacs23); should I ask here or in #emacs?16:58
marienzI only lightly use that integration16:58
lvhI used to use DVC16:58
lvhNow I'm trying VC since it's supposed to be good16:59
lvhbasically I made some changes; I was expecting C-u C-x v v to let me use a different branch16:59
marienzI haven't used dvc much16:59
lvh(currently on "trunk", I'd like to put these changes in a new branch)16:59
marienzI don't understand how that'd work (that sounds like it'd require VC knowing much more about how my branches are organized on-disk than it normally does)17:00
lvhI was expecting it to be really clever and understand how repositories work17:02
lvhSo how are you supposed to branch from emacs17:03
marienzrepositories can work however you want them to. I just use bzr commandline commands to branch17:05
marienz"branch" in my case frequently means "create a new branch in a no-trees repository emacs knows nothing about, and then switch the lightweight checkout I work in"17:06
marienzthat's not really something I'm interested in teaching emacs how to do17:06
lvhBut M-x term is so many keystrokes :-(17:06
lvhI'll try #emacs, if that doesn't help I'm moving back to DVC17:06
marienzI don't know enough about vc to know if this is something it is interested in doing for you17:07
nhandlerI'm playing around with setting up a pre-commit bzr hook for a branch. It would simply run a single shell command. I saw the shell-hooks plugin, which looks like it would be better suited than writting a python plugin for the hook. I'm just having a problem figuring out a) where the plugin looks for the shell script (so I can use a relative path instead ofabsolute) and b) Where the shell script is actually run from18:08
Noldorinhas anyone had any success using bzr-svn with codeplex?20:40
Noldorindoesn't seem to be working for me20:40
jelmerNoldorin: the codeplex svn server is broken20:42
lvhHey20:42
Noldorinjelmer, ah i see.20:42
lvhSo what's the reccomended emacs integration for bzr20:42
jelmerNoldorin: it returns inconsistent data20:42
Noldorinjelmer, have the codeplex admins been notified of thisw?20:43
lvhthere's DVC, there's VC20:43
jelmerNoldorin: I don't know; I don't use any codeplex repositories but I've mentioned what the issue was to several people who ran into issues with codeplex.20:44
Noldorinright20:44
Noldorini think i remember you telling me now some time ago actually!20:44
Noldorinah well20:44
lvhthere's BzrEmacs which is kind of old20:45
Noldorinjelmer, any idea what the status of bzr-tfs is like?20:48
jelmerlvh: Sorry, I'm not an emacs user. Perhaps there's some folks on the Bazaar mailing list that can help.21:11
jelmerNoldorin, what's bzr-tfs?21:11
fullermdTalisman For Soupmaking?21:13
Noldorinjelmer, https://launchpad.net/bzr-tfs21:13
fullermdShucks.  I was looking forward to soup   :(21:15
lvhjelmer: Thanks, I'll give it a try21:22
jelmerNoldorin, ah, neat - I hadn't seen that yet21:23
Noldorinjelmer, indeed. unfortunately i can't get it to run here though...21:25
Noldorinneeds some ntlm module21:26
jelmerNoldorin: perhaps ask the author and cc the bazaar list?21:27
jelmerthe bzr-tfs plugin looks nice22:10
jelmertoo bad I don't have a Microsoft Team Foundation Server to test with :-P22:10
jelmerNoldorin, it looks like you need to install the python-ntlm module22:16
Noldorinjelmer, codeplex provides free TFS repos :)22:19
Noldorinjelmer, also, i installed python-ntlm, but no lucky...22:20
jelmerNoldorin: Can you follow-up to the mailing list? The original author announced it there a month ago, he might be able to help.22:21
Noldorinjelmer, sure, will give that a go. cheers22:21
=== AfC2 is now known as AfC
lifelessmgz: hey23:35
mgzhey lifeless23:40
mgzwas hoping you'd be around23:40
lifelessindeedy23:40
mgzso, the basic idea which is a bit hard to see in the big diff23:43
mgzis that inside TestSuite.run running each TestCase is delegated to a teeny function that only returns a weakref23:44
lifeless...23:45
lifeless(Why?)23:45
mgzbecause we need to drop the reference, and then check whether the case is in fact still alive23:45
lifelesstheres a missing cause/assumption here23:45
lifelessI'm at sea23:45
mgzhm... I'll try another angle.23:46
mgzwe want to deallocate test case instances after they run, and *check* they're gone23:46
lifelessalso, lp:python-fixtures; new shiny for you23:46
lifelessmgz: why do we want to check that they are gone ?23:46
mgzbecause otherwise we get regressions.23:46
lifelessthis seems like a very hard proposition23:47
mgzwe've had hundreds of revs of the test suite being slow and flakey on my machine without the cause being very clear23:47
lifeless'do not think of the elephant'23:47
mgzand... it's not that hard23:47
lifelessmgz: yes, agree we need a means to improve and debug this23:47
lifelessI'm just trying to make sure I get each step of the logic properly ;)23:47
mgza weakref will return None when called, if the object it points at is gone23:48
lifelessso23:48
mgzif the case returned is None, all is fine, if it's still a test case, we complain23:48
lifelessthis implies a few things23:48
mgzcomplaining means I can find cycles.23:48
lifelessa) knowing if a given thing *should* be gone23:48
pooliehello mgz, lifeless23:48
mgzhey poolie23:49
lifelesspoolie: heya23:49
mgzI agree this is complicated and annoying.23:49
lifelessso, you could extend TestResult to permit querying 'are you still holding on to X'23:49
mgzBut I think I can do most of the annoying bits without inflicting them on everyone else who just has 8GB of ram and doesn't care.23:49
lifelessif it says 'no', then a weakref to X should return None23:49
mgzwhich problem are we trying to solve here?23:50
lifelessmgz: sure, my goal is to help you do this23:50
mgzI can live with the test result holding failed tests, in general, that should be a small number.23:50
mgzthe main issues are cycles (which is a judgment between avoiding them or running a gc collection after every test), and the decorators23:51
lifelessmgz: well, we want several things AIUI; actual cycles generated in the code should be obvious (like that stack one - meep); the test suite itself shouldn't create cycles [thus your detection logic]; the tests suite should run fast23:51
mgzI think those are achievable goals, the only thing being I've currently got "test not collected" but not any simple way of pointing out where the cycle is23:52
lifelesswell, meliae can tell, I expect.23:53
mgzI wondered if it might, I've just not tried.23:53
lifelessso we could have an option to use it for folk that want to debug these things23:53
mgzit's much easier to see the problem when it's in code you've just written, so if I fix the remaining ones then make non-collection into some kind of test failure I think that's sustainable23:55
lifelessok23:56
mgzif you've just written a test that closes over the test instance and pqm rejects it, I'd hope it wouldn't be hard to resolve.23:56
lifelessthat works for me23:56
mgzso if you're okay with that general approach, I think the remaining possible problem areas are that I've taken a hammer to the TestDecorator classes, and the new unit test _ExpectedFailure23:58
mgzwell, the first is if it's going to upset anything23:59

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!