Subject: [UFL-dev] [HG UFL] merge

From: [email-masked] (UFL)
Date: Tue, 16 Jun 2009 15:33:15 +0200 (CEST)

One or more new changesets pushed to the primary ufl repository.
A short summary of the last three changesets is included below.

changeset:   907:fe4e462aea075c22f750f0becf9733d5cf695ebe
tag:         tip
parent:      906:e7bd26c2c52c50e49a7d7b7fc2b3f3f56decbd27
parent:      905:114de4a60b04da8323be66bc11827e9b90a24b1e
user:        "Martin Sandve Alnæs <[email-masked]>"
date:        Tue Jun 16 15:33:14 2009 +0200
files:       
description:
merge

changeset:   906:e7bd26c2c52c50e49a7d7b7fc2b3f3f56decbd27
parent:      904:d6d428a9474cff080ebeb2cd94a325351540dd1f
user:        "Martin Sandve Alnæs <[email-masked]>"
date:        Tue Jun 16 15:32:52 2009 +0200
files:       test/newtests/test_analysis/__init__.py test/newtests/test_compounds/__init__.py test/newtests/test_demos/__init__.py test/newtests/test_derivatives/__init__.py test/newtests/test_elements/__init__.py test/newtests/test_elements/test_cells.py test/newtests/test_elements/test_elements.py test/newtests/test_evaluation/__init__.py test/newtests/test_exprbasics/__init__.py test/newtests/test_indexing/__init__.py
description:
Added new test directory, planning to migrate to nose based unit tests.

changeset:   905:114de4a60b04da8323be66bc11827e9b90a24b1e
user:        "Martin Sandve Alnæs <[email-masked]>"
date:        Mon Jun 15 19:03:19 2009 +0200
files:       doc/manual/chapters/formlanguage.tex ufl/__init__.py ufl/algebra.py ufl/exproperators.py
description:
Added note on time derivative in manual.

----------------------------------------------------------------------
For more details, visit http://www.fenics.org/hg/ufl

---

From: Anders Logg <[email-masked]>
Date: Tue, 16 Jun 2009 23:51:58 +0200

> Added new test directory, planning to migrate to nose based unit tests.

What is a nose based unit test?

-- 
Anders

---

From: Kristian Oelgaard <[email-masked]>
Date: Wed, 17 Jun 2009 10:00:26 +0200

Quoting Anders Logg <[email-masked]>:

> > files:       test/newtests/test_analysis/__init__.py
> test/newtests/test_compounds/__init__.py test/newtests/test_demos/__init__.py
> test/newtests/test_derivatives/__init__.py
> test/newtests/test_elements/__init__.py
> test/newtests/test_elements/test_cells.py
> test/newtests/test_elements/test_elements.py
> test/newtests/test_evaluation/__init__.py
> test/newtests/test_exprbasics/__init__.py
> test/newtests/test_indexing/__init__.py
> > description:

'nose' is an extension of unittest and it's supposed to be easier to use.

http://code.google.com/p/python-nose/

Kristian

---

From: Martin Sandve Alnæs <[email-masked]>
Date: Wed, 17 Jun 2009 10:35:07 +0200

1) sudo apt-get install python-nose

2) write files called "test_*.py"

3) implement functions "def test_*(): ..." in "test_*.py", use
"assert" to check things

4) run "nosetests", and all tests are discovered

You can also make packages called "test_*/" to have hierarchies of tests,
with no extra lines for non-test code. The command nosetests can aid in
some things like profiling and code coverage, but I've only just looked at
it briefly. I particularly like test generators:

def check_stuff(i, j):
    assert i + j > 2

def test_stuff():
    for i in range(10):
        for j in range(10):
            yield check_stuff, i, j

Which makes a range of tests calling check_stuff with different arguments.
The above test gives 6 errors like these:

martinal@martinal-xps:~/dev/fenics/ufl/test/newtests/test_exprbasics$ nosetests
FFF.......FF........F...............................................................................
======================================================================
FAIL: test_exprbasics.test_foo.test_stuff(0, 0)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/lib/python-support/python2.5/nose/case.py", line 182, in runTest
    self.test(*self.arg)
  File "/home/martinal/dev/fenics/ufl/test/newtests/test_exprbasics/test_foo.py",
line 3, in check_stuff
    assert i + j > 2
AssertionError

======================================================================
FAIL: test_exprbasics.test_foo.test_stuff(0, 1)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/lib/python-support/python2.5/nose/case.py", line 182, in runTest
    self.test(*self.arg)
  File "/home/martinal/dev/fenics/ufl/test/newtests/test_exprbasics/test_foo.py",
line 3, in check_stuff
    assert i + j > 2
AssertionError

...

Martin

On Wed, Jun 17, 2009 at 10:00 AM, Kristian
Oelgaard<[email-masked]> wrote:
> _______________________________________________
> UFL-dev mailing list
> [email-masked]
> http://fenics.org/mailman/listinfo/ufl-dev
>

---

From: Anders Logg <[email-masked]>
Date: Wed, 17 Jun 2009 17:55:05 +0200

Is it possible to combine this with a common file test.py that call
nosetests to run all tests? To make it uniform across the packages.

-- 
Anders

---

From: Martin Sandve Alnæs <[email-masked]>
Date: Wed, 17 Jun 2009 18:01:46 +0200

Sure.
Martin

On Wed, Jun 17, 2009 at 5:55 PM, Anders Logg<[email-masked]> wrote:
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAko5EdkACgkQTuwUCDsYZdEVTACeKA3ReS+PYBAAooltymDGdZyY
> jPYAn3Wuu0k4hKskuDw64EADYfYy/SrB
> =q7ZK
> -----END PGP SIGNATURE-----
>
>