« first day (3 days earlier)      last day (150 days later) » 

12:00
i suggest .sync() to hurry up the disk write
are you sure about that?
pull speedups
we should see significant increase.
whispers there?
dang @jokerdino
hey
yeah, what was it?
pull from repo.
and retry.
I am expecting massive speed improvements.
12:12
can i throw away local modifications in git repo?
yup.
ok git stash
no massive changes
very well, if you are going to stick to .apply(), i won't see any change
that .apply doesn't get called. :P
and nothing gets applied either
use .sync()
does it really make a difference? check it.
12:15
yes
I use .apply() only when I detect delay apply mode.
get rid of it if necessary.
here goes: sync() shows instant change but the overall process is slow.
if nothing, no instant change but looks like it still takes the same time to complete the process
is it because I'm creating a class?
seriously, no difference other than that.
possibly?
But this is cleaner.
We'll stick.
12:19
well, it takes a looong time to update
Lets ask someone.
didrocks, may be?
perhaps
there is a ~ file in git
how can there be?
I didn't commit any I believe..
lemme check
untracked.
thanks
12:22
nvr mind
what next?
finish the half written unittest.py :P
why is one thing symlinked to the other?
I need to import.
hm okay
for that, I cant have hyphens.
12:24
then remove the master file or something
So i just symlinked for the time being.
okay.
can you finish the half-complete unittest.py?
okay. o.O
:P
I'm teaching you python, buddy.
thank me.
12:26
i have written something in tests/booltest.py
do something for string array and others
why nsettings in filelens?
i didn't have a def earlier
and gsettings in the other?
then put it under a def
oh. okay.
we dont need to test for each type.
we are not using anything thats type-specific.
12:30
we need to test for com.cano.. and org.compiz. also test with changing the plugins.
one reloco. and one static and one with changing plugins
open up unittest.py
add as many testcases we want as methods.
okay
what?
only condition is they must start with test_
o.O
ok. set.
how does the test work?
scroll down to basic example.
12:33
i see that.
need help?
okay. where exactly are you stuck?
how exactly are we testing anything?
i can set an option away from default but then on, how?
pick something to change and test if its reset
then write a def test_something
in that method, we set the value away from default.
12:40
makes sense. let me whip out something.
then call unityreset.UnityReset()
okay :))
then self.assertTrue(key==itsdefaultvalue)
Righto.
you know the key because you picked it. get its value.
default values are there in the dicts.
12:42
o.O
where is the dict?
setUp()
two variables. you see them?
they are dicts.
yeah but they are just the plugins?
where do i get the key value?
compizPlugins[pluginschema][key] should give you the value.
similarly for the other one.
okay o.O
brb
The magic of nested dicts. :D
okay.
why do I see your ghost here? @jrg :P
jrg
jrg
12:46
because i am everywhere and nowhere
oh.
yes what?
yes
the troll answer
@mahesh, can i just use the booltest.py?
grab it and add as methods in unittest.py
12:53
yes that
to reset, you have unityreset.UnityReset()
and dont import Gio again.
neat
no i wont
use Gio=unityreset.Gio if at all needed.
you'll need that to set key to non default value.
i was doing it in booltest
weren't you copying it into unittest?
12:56
just following the style
umm... one unittest.py will cover all test cases.
each def test_something will be a testcase.
all will be taken care of unittest.
got it
so, better copy things over and get rid of rest.
 def test_staticschema(self):
        gsettings=Gio.Settings("com.canonical.Unity.ApplicationsLens")
        if "display-recent-apps" in gsettings.list_keys():
            if gsettings.get_boolean("display-recent-apps") is True:
            #print "Unsetted default"
                gsettings.set_boolean("display-recent-apps",False)
        unityreset.UnityReset()
        key=gsettings.get_boolean("display-recent-apps")
        self.assertTrue(key==True)
like that?
yup. something like that.
13:00
how do i test what i wrote is not rubbish?
use get_value if instead of all variants.
ok done
just run the file.
AttributeError: 'module' object has no attribute 'TestCase'
hm
ah. rename the file to something else and retry.
:P
13:03
which file?
unittest.py
it conflicts with module name.
renameit to unityresetunittestsohilovelongnames.py
same error
$ python faketest.py
Traceback (most recent call last):
  File "faketest.py", line 3, in <module>
    import unittest
  File "/home/jokerdino/unity-reset/unittest.py", line 7, in <module>
AttributeError: 'module' object has no attribute 'TestCase'
is unittest.py still there?
get rid of unittest.py. rename it.
13:06
ok there was a pyc
File "faketest.py", line 12, in setUp
    compizPlugins=unityreset.UnityReset.snapshotCompizPlugins()
TypeError: unbound method snapshotCompizPlugins() must be called with UnityReset instance as first argument (got nothing instead)

----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)
oh.
gimme a sec.
git commit locally then git pull origin master
updated unity-reset.py. the methods were not static earlier.
mhk
different error
Traceback (most recent call last):
  File "faketest.py", line 12, in setUp
    compizPlugins=unityreset.UnityReset.snapshotCompizPlugins()
  File "/home/jokerdino/unity-reset/unityreset.py", line 95, in snapshotCompizPlugins
    for schema in allRelocatableSchemas:
NameError: global name 'allRelocatableSchemas' is not defined

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)
pull and retry
13:19
it resets my unity
but no result of whether pass or fail
i should have waited. my bad
trying again
oh.
actually, unity doesn't return control I guess. scroll and find things in output.
Killed
F
======================================================================
FAIL: test_staticschema (__main__.TestUnityReset)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "faketest.py", line 26, in test_staticschema
    self.assertTrue(key==True)
AssertionError: False is not true

----------------------------------------------------------------------
Ran 1 test in 41.561s

FAILED (failures=1)
started another unity in another terminal
you sure that key goes to true?
13:22
 def test_staticschema(self):
        gsettings=Gio.Settings("com.canonical.Unity.ApplicationsLens")
        if "display-recent-apps" in gsettings.list_keys():
            if gsettings.get_value("display-recent-apps") is True:
            #print "Unsetted default"
                gsettings.set_value("display-recent-apps",False)
        unityreset.UnityReset()
        key=gsettings.get_value("display-recent-apps")
        self.assertTrue(key==True)
wait....
either i should wait for it to be written or i am doing it wrong?
i am thinking i should use set_boolean instead
you have to check unityChildren['com.canonical.Unity.ApplicationsLens']['display-recent-apps']
why do you do this?
do what?
if "display-recent-apps" in gsettings.list_keys():
if gsettings.get_value("display-recent-apps") is True:
#print "Unsetted default"
gsettings.set_value("display-recent-apps",False)
13:24
you said copy from booltest.py
oh. okay.
open python shell
in the same folder.
import unityreset
unityChildren=unityreset.UnityReset.snapshotUnityChildren()
unityChildren['com.canonical.Unity.ApplicationsLens']['display-recent-apps']
what does it say?
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/gi/overrides/GLib.py", line 182, in __repr__
    return "GLib.Variant('%s', %s)" % (self.format_string, self.print_(True))
AttributeError: 'Variant' object has no attribute 'format_string'
appears
how's it going?
13:26
bad. :/
What's wrong
I wasn't really paying attention that time
print unityChildren['com.canonical.Unity.ApplicationsLens']['display-recent-apps']
true
small true
not True
jrg
jrg
do you guys need/want help?
okay.
so the default is true.
@jrg yup.
13:28
@jrg yup
then we set it to false.
set it.
jrg
jrg
alright, let me go re-read the log
i am checking for True and not true
Gio=unityreset.Gio
@jokerdino yup that.
thats the prob then.
Killed
.
----------------------------------------------------------------------
Ran 1 test in 47.496s

OK
actually, the problem was with get_value and get_boolean
def test_staticschema(self):
        gsettings=Gio.Settings("com.canonical.Unity.ApplicationsLens")
        if "display-recent-apps" in gsettings.list_keys():
            if gsettings.get_boolean("display-recent-apps") is True:
            #print "Unsetted default"
                gsettings.set_boolean("display-recent-apps",False)
        unityreset.UnityReset()
        key=gsettings.get_boolean("display-recent-apps")
        self.assertTrue(key==True)
this works -^
might be either set_boolean or get_boolean
13:31
yup.
the return type is bad for us.
lets stash my fancinedd and do it the good old way then.
Ok, now can someone explain to me what in the name of gnu is going on?
:P
dino will tell you.
Killed
F
======================================================================
FAIL: test_staticschema (__main__.TestUnityReset)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "faketest.py", line 26, in test_staticschema
    self.assertTrue(key==True)
AssertionError: False is not true

----------------------------------------------------------------------
Ran 1 test in 33.244s

FAILED (failures=1)
def test_staticschema(self):
        gsettings=Gio.Settings("com.canonical.Unity.ApplicationsLens")
        if "display-recent-apps" in gsettings.list_keys():
            if gsettings.get_value("display-recent-apps") is True:
            #print "Unsetted default"
                gsettings.set_boolean("display-recent-apps",False)
        unityreset.UnityReset()
        key=gsettings.get_value("display-recent-apps")
        self.assertTrue(key==True)
@jokerdino Tell me
so, we should use get_boolean @Mahesh
13:33
yup.
@AmithKK writing unit tests
or change the assertTrue statement.
to true?
key is a Glib.Variant type.
13:33
so, see if key==Glib.Variant(true) works.
ok
how can I help :D
but we need to import something to access Glib.
@AmithKK once we get the first unit test straight.
@Mahesh from gi_repository :P ?
jrg
jrg
or can you stub your glib responses?
we'll each pick one and rock.
13:35
ok trying with true
@jokerdino try from gi.repository import Glib in python shell
jrg
jrg
i'm not as up-to-date on my python testing frameworks, but in ruby I can stub a response for an external API or something.
@jokerdino nope. you have to try it with a Glib.Variant type object.
not a string.
true fails. we should just use get_boolean :P
@jrg stub?
jrg
jrg
13:36
that way i just import the response, and not the actual library, since the library can break.
@jokerdino just use get_boolean
nope. lets try things better.
jrg
jrg
@Mahesh ok, guess it doesn't support that. ignore me.
you are talking of doctest.
@jrg I don't think the unit test framework supports stubbing. :D
13:37
well, the python counterpart is doctest.
@Mahesh Never used that :P
jrg
jrg
@AmithKK this is a lame testing framework. :P
@jokerdino open up a python shell.
you mean import GLib
then what?
jrg
jrg
anyway. i'll try and catch up on this stuff.
13:37
from gi.repository import GLib,Gio
okay
next?
a=Gio.Settings("com.canonical.Unity.ApplicationsLens").get_value("display-recent-apps")
a=Gio.Settings("com.canonical.Unity.ApplicationsLens").get_value("display-recent-apps")
>>> print a
true
okay.
b=GLib.Variant(True)
print b
You need to assign Ninja'd
13:39
a==b
if thats a true, congratulate me.
 b=GLib.Variant(True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __new__() takes exactly 3 arguments (2 given)
great.
dig up its constructor.
dig up documentation for GLib.Variant
hm, fire drill
fire drill. bye!
b=GLib.Variant('b',True)
@jokerdino enjoy. :P
@jokerdino bye
happy fire drill
Grr
b=GLib.Variant('b',True)
>>> a==b
True
you know what? this is one of the most horribly undocumented areas
@jokerdino Thanks. :D
13:46
yeah
I approve
okay. good luck
bbl
@jrg we were working with nearly zero documentation support. any ideas?
okay, someone turned off the fire alarm, i am back
jrg
jrg
13:48
Write documentation for the next guy?
yay!!!!
@jrg bah
Aww screw this
jrg
jrg
Ok, re-reading
we're writing a huge blog post after this
now i congratulate you. what next @mah?
13:49
@jokerdino @jokerdino okay. Use my beautiful dict to see defaults.
reset as we did.
gimme code
then while asserting true,
jrg
jrg
@Mahesh: so you got it working (after a fashion), right?
aaarrrrgh.
wait then.
@jrg yeah :D
13:49
@jrg yup. its all working now.
ok real f-ing fire
OH MY GOD
@jokerdino RUN
BBBBBBYE
RUN LIKE THE WIND
be safe
bye @jokerdino
jrg
jrg
Be safe @jokerdino
13:57
what? real fire??? o_O
hmm.. okay.
@AmithKK pull it and write some more methods in similar way.
@jrg you can help us here.
jrg
jrg
who has a copy of the latest code, and can i git clone it?
@jrg yep

« first day (3 days earlier)      last day (150 days later) »