h1

More Testing

April 12, 2010

I have fixed the test for hg branches. Since the HgClone clones automatically all branches, I cloned then tried switching to the last branch/revision using Hg checkout and checked for the existence of the files that are only on that branch. If the branch wasn’t cloned it will give the following output:

C:\Users\Fatima\pony-build-hg-test>hg branches
extrabranch 7:1d4537588c4c
default 2:949a4d660f2e (inactive)

C:\Users\Fatima\pony-build-hg-test>hg checkout fatima
abort: unknown revision ‘fatima’!

I have create a new branch f_master and added the test to it :
http://github.com/cherkf/pony-build/blob/f_master/client/test_client/test_hg_client.py

Next, I am trying to figure out how to test the RSS feed to all branches http://github.com/ctb/pony-build/blob/master/pony_build/rss.py

The RSS feed that pony-build have are pushed to the “Pubsubhubbub” server. The hub from the PubsubHubbub fetches the published feed and multicasts the new/modified content out to all registered subscribers.

h1

Testing

March 29, 2010

This week, I have learned how to run tests on Pony-build using the nosetests script. I had to download the nose package and make sure that the nosetests is added to the path in the environment variables. Running tests then become as easy as typing “nosetests” once in the right directory or “nosetests + name of the test file” to run that specific test.
My objective this week, was to write a test for branches other than default.

When cloning a repository in mercurial, the working directory is updated to the tip, which is the most recent changeset /commit in the repo. So it actually doesn’t matter in which branch we currently are , since the clone will happen in the branch, committed to last.

Hg identify prints a summary of the current state of the repository
C:\Users\Fatima\pony-build-hg-test>hg identify
1d4537588c4c (extrabranch) tip
Switched to the default branch
C:\Users\Fatima\pony-build-hg-test>hg update default
resolving manifests
removing test3.txt
removing test4.py
getting test1
1 files updated, 0 files merged, 2 files removed, 0 files unresolv

C:\Users\Fatima\pony-build-hg-test>hg identify
949a4d660f2e

Hg tip to show the most recent changeset in the repository. We are still in the Default branch:

C:\Users\Fatima\pony-build-hg-test>hg tip
changeset: 7:1d4537588c4c
branch: extrabranch
tag: tip
user: Fatima Cherkaoui
date: Mon Mar 15 18:52:04 2010 -0500
files: test1
description:
test1

“Hg Clone” clones all branches automatically and points to the default branch.
C:\Users\Fatima\pony-build-hg-test>cd pony-build-hg-test

C:\Users\Fatima\pony-build-hg-test\pony-build-hg-test>ls
test1 test2

C:\Users\Fatima\pony-build-hg-test\pony-build-hg-test>hg branch
default

C:\Users\Fatima\pony-build-hg-test\pony-build-hg-test>hg branches
extrabranch 7:1d4537588c4c
default 2:949a4d660f2e (inactive)

So if we are in branch other than default we can:
—>clone then update to that branch: hg clone and hg update branchname
—> clone directly to the branch and/or revision : hg clone -r branchname

C:\Users\Fatima\pony-build-hg-test>hg clone http://bitbucket.org/cherkf/pony-bu
ld-hg-test/ -r extrabranch
destination directory: pony-build-hg-test
requesting all changes
adding changesets
adding manifests
adding file changes
added 8 changesets with 7 changes to 4 files
updating to branch extrabranch
4 files updated, 0 files merged, 0 files removed, 0 files unresolved

C:\Users\Fatima\pony-build-hg-test>cd pony-build-hg-test

C:\Users\Fatima\pony-build-hg-test\pony-build-hg-test>hg branch
extrabranch

C:\Users\Fatima\pony-build-hg-test\pony-build-hg-test>hg branches
extrabranch 7:1d4537588c4c
default 2:949a4d660f2e (inactive)

h1

More on Named Branches

March 20, 2010

In my named branch extrabranch, I cloned the coverage package.

C:\Users\Fatima\pony-build-hg-test>hg branch extrabranch
C:\Users\Fatima\pony-build-hg-test>ls
mercurial-repo test1 test2 test3.txt test4.py
C:\Users\Fatima\pony-build-hg-test>hg clone http://bitbucket.org/ned/coveragepy/
destination directory: coveragepy
requesting all changes
adding changesets
adding manifests
adding file changes
added 762 changesets with 1904 changes to 241 files
updating to branch default
203 files updated, 0 files merged, 0 files removed, 0 files unresolved

Checked if the package is there :
C:\Users\Fatima\pony-build-hg-test>ls
coveragepy mercurial-repo test1 test2 test3.txt test4.py
And if we are still in the same branch
C:\Users\Fatima\pony-build-hg-test>hg branch
extrabranch

Now switched to the default branch
C:\Users\Fatima\pony-build-hg-test>hg update default
resolving manifests
removing test3.txt
removing test4.py
getting test1
1 files updated, 0 files merged, 2 files removed, 0 files unresolved

C:\Users\Fatima\pony-build-hg-test>hg branch
default

The package is there.
C:\Users\Fatima\pony-build-hg-test>ls
coveragepy mercurial-repo test1 test2

Hg status doesn’t show any file added, so cannot commit or push.
C:\Users\Fatima\pony-build-hg-test>hg status
C:\Users\Fatima\pony-build-hg-test>hg commit
nothing changed

C:\Users\Fatima\pony-build-hg-test>hg push
real URL is https://bitbucket.org/cherkf/pony-build-hg-test/
pushing to https://cherkf@bitbucket.org/cherkf/pony-build-hg-test
searching for changes
no changes found

To fetch the two branches in hg, we need to hg Merge then hg commit.
In the default branch,I used the -P extension to show a preview of the merge before performing it

C:\Users\Fatima\pony-build-hg-test>hg merge -P extrabranch
changeset: 3:e2a62a3939f7
branch: extrabranch
user: Fatima Cherkaoui
date: Sat Mar 13 15:48:16 2010 -0600
description:
start a new branch

changeset: 4:d50e059fcd4f
branch: extrabranch
user: Fatima Cherkaoui
date: Sat Mar 13 16:13:14 2010 -0600
files: test3.txt
description:
‘test3.txt’

changeset: 5:b7399aa89111
branch: extrabranch
user: Fatima Cherkaoui
date: Sun Mar 14 20:04:40 2010 -0500
files: test4.py
description:
test4

changeset: 6:356d42d7cd3d
branch: extrabranch
user: Fatima Cherkaoui
date: Mon Mar 15 18:20:30 2010 -0500
files: test3.txt
description:
test3.txt

changeset: 7:1d4537588c4c
branch: extrabranch
tag: tip
user: Fatima Cherkaoui
date: Mon Mar 15 18:52:04 2010 -0500
files: test1
description:
test1

If we want to clone from a specific branch : Hg clone url -r branchName

C:\Python26>hg clone https://cherkf@bitbucket.org/cherkf/pony-build-hg-test/ -r
default
destination directory: pony-build-hg-test
requesting all changes
adding changesets
adding manifests
adding file changes
added 3 changesets with 3 changes to 2 files
updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
C:\Python26>cd pony-build-hg-test
C:\Python26\pony-build-hg-test>ls
test1 test2

h1

Branching in Mercurial

March 16, 2010

This week I have started exploring branching in Mercurial.
Branching occurs when a changeset is commited within a single repository or two repositories that were cloned from the same repo.
Branching in Mercurial is usually anonymous , but a named branch can be created only within a single repository.
I have created a named branch called extrabranch: hg branch extrabranch
C:\Users\Fatima\pony-build-hg-test>hg branches
extrabranch 5:b7399aa89111
default 2:949a4d660f2e (inactive)

Now the tip is on the extrabranch and we can check that by typing hg parents:
C:\Users\Fatima\pony-build-hg-test>hg parents
changeset: 5:b7399aa89111
branch: extrabranch
tag: tip
user: Fatima Cherkaoui
date: Sun Mar 14 20:04:40 2010 -0500
files: test4.py

description:
test4

Now if we add or modify any file it will be under the extrabranch.
We can switch between branches using hg update.
C:\Users\Fatima\pony-build-hg-test>hg update default
resolving manifests
removing test3.txt
removing test4.py
0 files updated, 0 files merged, 2 files removed, 0 files unresolved

C:\Users\Fatima\pony-build-hg-test>ls
coveragepy mercurial-repo new 2.py test1 test2

C:\Users\Fatima\pony-build-hg-test>hg update extrabranch
resolving manifests
getting test3.txt
getting test4.py
2 files updated, 0 files merged, 0 files removed, 0 files unresolved

C:\Users\Fatima\pony-build-hg-test>ls
coveragepy mercurial-repo new 2.py test1 test2 test3.txt test4.py

When cloning the coverage repo it goes directly to the default branch not the extrabranch as the repo has different parents.

The next step is to check how to do merges of branches with different parents like it is done in Git (what’s called “Octopus merges”.

Note: I’m glad we are using Github for our project. Bitbucket link seems to be broken most of the time.

h1

Moving on

March 9, 2010

Last week I have mentioned the failing tests for the Mock Package.
I have checked and made the same updates made to the mock.py here but my test still failed .

I then contacted Micheal Foord who explained that the behavior was correct but the test wasn’t fixed yet and that he will include it in the next release.

http://lists.idyll.org/pipermail/pony-build/2010-March/000148.html

Also, I have created a bitbucket account and forked Titus’s pony-build-hg-test repo to start experimenting.
http://lists.idyll.org/pipermail/pony-build/2010-February/000118.html

h1

Midway Updates

February 28, 2010

Few months ago,when I first joined Pony-build, I was excited and eager to learn more about this project in particular and open-source in general. I knew my limited experience might make my progress slower than expected but I was determined to learn more no matter what.
I couldn’t join the UCOSP community for the “Code Sprint” in Canada; however, I started to communicate with the project lead Titus C. Brown and the rest of the group via Skype to make the initial system set ups. I encountered many problems throughout the process, but Titus was always patient and very helpful.
Getting familiar with Git and the already written code took me more than a while. My first build fully worked after few weeks , but when I have started my second one, it took me few hours to get it build and compile which shows the big progress I’m making.
I have also learned how to ask for help from the rest of the group, who have been ready to lend a hand when needed.
Today, my enthusiasm remains the same and I’m ready to learn more.

h1

This week

February 28, 2010

    Build-Mock Step-by-Step

This week I have written a build script for the Mock package. This time it was much easier task as I was more familiar with the concept and the code.

The mock package uses subversion so I first found the repo_url : http://mock.googlecode.com/svn/trunk/ then checked the SvnCheckout in the pony_client . I’ve noticed that dirname is not guessed like in HgClone or GitClone but should be given from the beginning as it is part of the _init parameters.
My build then worked but the tests didn’t run.

The Error I got was :

command line:[‘python’, ‘setup.py’, ‘test’]
no stdout
stderr:
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] …] or: setup.py –help [cmd1 cmd2 …] or: setup.py –help-commands or: setup.py cmd –help error: invalid command ‘test’

To fix it , I checked if the test file exists in the package. My assumption was right there was instead a “tests” one. I then replaced test with tests but it still failed giving me the same error .
I discovered then that the mock package uses “discover.py” to run its tests.

This time the tests ran but failed one of them :

……F………………………………………………….. ====================================================================== FAIL: testMagicMethodWrapping (tests.testmagicmethods.TestMockingMagicMethods) ———————————————————————- Traceback (most recent call last): File “c:\users\fatima\appdata\local\temp\tmpwotcmh\mock\tests\testmagicmethods.py”, line 47, in testMagicMethodWrapping self.assertEqual(inspect.getargspec(mock.__getitem__), inspect.getargspec(f)) AssertionError: ArgSpec(args=[‘name’], varargs=None, keywords=None, defaults=None) != ArgSpec(args=[‘self’, ‘name’], varargs=None, keywords=None, defaults=None) ———————————————————————- Ran 66 tests in 0.077s FAILED (failures=1)

http://lyorn.idyll.org/ctb/pb-dev/p/build-mock/17611/

    Learning how to deal with branches

I noticed that when I type “git branch” both mkdir and master are listed but when moving in my directory the main branch changes each time. So I have decided to make it mkdir all over: “git branch -m master mkdir”

I have also changed my default branch to mkdir in github. ( under admin).

When trying to push my build-mock (using the usual add , commit and push) I got a non-fast-forward error.
I then pulled again from ctb repo to the mkdir branch.
I got merging error . The git Status showed me that two files (dbsqlite.py & style.css) that I’ve never recall opening were modified. The git diff showed that both filed were almost re-written.
I used ” git checkout & git ls-files -m ” to discard the changes made in my working directory that are not added to the index yet (unstaged changes)

Now when I push “git push git@github.com:cherkf/pony-build.git mkdir” the push works, but I still get a non fast-forward error for the master branch .
! [rejected] master -> master (non-fast forward)

I will look more through those small issues the coming days.