[GRASS-dev] Running python test: why are they not running?

Hi

I am working on the homebrew script for OS X and am trying to implement
the tests. I download the test dataset, extract it, and run

--8<---------------cut here---------------start------------->8---
grass71 ./nc_basic_spm_grass7/PERMANENT --exec python -m grass.gunittest.main --location './nc_basic_spm_grass7' --location-type nc
--8<---------------cut here---------------end--------------->8---

But I get the following:

,----
| ==> tar xzf ./nc_basic_spm_grass7.tar.gz
| ==> ls -l ./nc_basic_spm_grass7/
| total 24
| -rw-r--r-- 1 rainerkrug wheel 1035 Nov 3 2008 CREDITS.txt
| -rw-r--r-- 1 rainerkrug wheel 2710 Jul 25 2013 HISTORY.txt
| drwxr-xr-x 18 rainerkrug wheel 612 Feb 13 2013 PERMANENT
| -rw-r--r-- 1 rainerkrug wheel 130 Nov 26 2012 VERSION.txt
| drwxr-xr-- 16 rainerkrug wheel 544 Jul 25 2013 user1
| ==> grass71 ./nc_basic_spm_grass7/PERMANENT --exec python -m grass.gunittest.main --location './nc_basic_spm_grass7' --location-type nc
| WARNING: Default locale settings are missing. GRASS running with C locale.
| Starting GRASS GIS...
| Executing <python -m grass.gunittest.main --location ./nc_basic_spm_grass7 --location-type nc> ...
|
| Executed 0 test files in 0:00:00.046629.
| From them 0 files (unknown percentage) were successful and 0 files (unknown percentage) failed.
| Execution of <python -m grass.gunittest.main --location ./nc_basic_spm_grass7 --location-type nc> finished.
| Cleaning up temporary files...
| 04:57:47 ~$
`----

If I run the same command in my home directory, where the dataset is
also installed, the tests run as expected.

Any suggestions why the tests do not run?

The data is downloaded, and extracted (see the ls -l above).

Any suggestions?

Thanks,

Rainer

--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax : +33 - (0)9 58 10 27 44

Fax (D): +49 - (0)3 21 21 25 22 44

email: Rainer@krugs.de

Skype: RMkrug

PGP: 0x0F52F982

On Wed, Aug 19, 2015 at 11:02 AM, Rainer M Krug <Rainer@krugs.de> wrote:

Hi

I am working on the homebrew script for OS X and am trying to implement
the tests. I download the test dataset, extract it, and run

--8<---------------cut here---------------start------------->8---
grass71 ./nc_basic_spm_grass7/PERMANENT --exec python -m
grass.gunittest.main --location './nc_basic_spm_grass7' --location-type nc
--8<---------------cut here---------------end--------------->8---

But I get the following:

,----
| ==> tar xzf ./nc_basic_spm_grass7.tar.gz
| ==> ls -l ./nc_basic_spm_grass7/
| total 24
| -rw-r--r-- 1 rainerkrug wheel 1035 Nov 3 2008 CREDITS.txt
| -rw-r--r-- 1 rainerkrug wheel 2710 Jul 25 2013 HISTORY.txt
| drwxr-xr-x 18 rainerkrug wheel 612 Feb 13 2013 PERMANENT
| -rw-r--r-- 1 rainerkrug wheel 130 Nov 26 2012 VERSION.txt
| drwxr-xr-- 16 rainerkrug wheel 544 Jul 25 2013 user1
| ==> grass71 ./nc_basic_spm_grass7/PERMANENT --exec python -m
grass.gunittest.main --location './nc_basic_spm_grass7' --location-type nc
| WARNING: Default locale settings are missing. GRASS running with C
locale.
| Starting GRASS GIS...
| Executing <python -m grass.gunittest.main --location
./nc_basic_spm_grass7 --location-type nc> ...
|
| Executed 0 test files in 0:00:00.046629.
| From them 0 files (unknown percentage) were successful and 0 files
(unknown percentage) failed.
| Execution of <python -m grass.gunittest.main --location
./nc_basic_spm_grass7 --location-type nc> finished.
| Cleaning up temporary files...
| 04:57:47 ~$
`----

If I run the same command in my home directory, where the dataset is
also installed, the tests run as expected.

Any suggestions why the tests do not run?

The data is downloaded, and extracted (see the ls -l above).

Any suggestions?

Do you run it from the directory with the source code? The tests are only
in the source code. `python -m grass.gunittest.main` will find all tests in
all subdirectories of the current directory.

Vaclav

https://grass.osgeo.org/grass71/manuals/libpython/gunittest_testing.html#testing-with-gunittest-package-in-general
https://grass.osgeo.org/grass71/manuals/libpython/gunittest_running_tests.html#running-tests-report

Thanks,

Rainer

--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax : +33 - (0)9 58 10 27 44

Fax (D): +49 - (0)3 21 21 25 22 44

email: Rainer@krugs.de

Skype: RMkrug

PGP: 0x0F52F982

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Vaclav Petras <wenzeslaus@gmail.com> writes:

On Wed, Aug 19, 2015 at 11:02 AM, Rainer M Krug <Rainer@krugs.de> wrote:

Hi

I am working on the homebrew script for OS X and am trying to implement
the tests. I download the test dataset, extract it, and run

--8<---------------cut here---------------start------------->8---
grass71 ./nc_basic_spm_grass7/PERMANENT --exec python -m
grass.gunittest.main --location './nc_basic_spm_grass7' --location-type nc
--8<---------------cut here---------------end--------------->8---

But I get the following:

,----
| ==> tar xzf ./nc_basic_spm_grass7.tar.gz
| ==> ls -l ./nc_basic_spm_grass7/
| total 24
| -rw-r--r-- 1 rainerkrug wheel 1035 Nov 3 2008 CREDITS.txt
| -rw-r--r-- 1 rainerkrug wheel 2710 Jul 25 2013 HISTORY.txt
| drwxr-xr-x 18 rainerkrug wheel 612 Feb 13 2013 PERMANENT
| -rw-r--r-- 1 rainerkrug wheel 130 Nov 26 2012 VERSION.txt
| drwxr-xr-- 16 rainerkrug wheel 544 Jul 25 2013 user1
| ==> grass71 ./nc_basic_spm_grass7/PERMANENT --exec python -m
grass.gunittest.main --location './nc_basic_spm_grass7' --location-type nc
| WARNING: Default locale settings are missing. GRASS running with C
locale.
| Starting GRASS GIS...
| Executing <python -m grass.gunittest.main --location
./nc_basic_spm_grass7 --location-type nc> ...
|
| Executed 0 test files in 0:00:00.046629.
| From them 0 files (unknown percentage) were successful and 0 files
(unknown percentage) failed.
| Execution of <python -m grass.gunittest.main --location
./nc_basic_spm_grass7 --location-type nc> finished.
| Cleaning up temporary files...
| 04:57:47 ~$
`----

If I run the same command in my home directory, where the dataset is
also installed, the tests run as expected.

Any suggestions why the tests do not run?

The data is downloaded, and extracted (see the ls -l above).

Any suggestions?

Do you run it from the directory with the source code? The tests are only
in the source code. `python -m grass.gunittest.main` will find all tests in
all subdirectories of the current directory.

OK - this explains,as the tests are run in a temporary directory.

The easiest might be to checkout the tests before usage. How can I check
them out from svn and in which folder are they located? But I assume
they have to be compiled before usage?

Thanks,

Rainer

Vaclav

https://grass.osgeo.org/grass71/manuals/libpython/gunittest_testing.html#testing-with-gunittest-package-in-general
https://grass.osgeo.org/grass71/manuals/libpython/gunittest_running_tests.html#running-tests-report

Thanks,

Rainer

--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax : +33 - (0)9 58 10 27 44

Fax (D): +49 - (0)3 21 21 25 22 44

email: Rainer@krugs.de

Skype: RMkrug

PGP: 0x0F52F982

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax : +33 - (0)9 58 10 27 44

Fax (D): +49 - (0)3 21 21 25 22 44

email: Rainer@krugs.de

Skype: RMkrug

PGP: 0x0F52F982

On Thu, Aug 20, 2015 at 10:25 AM, Rainer M Krug <Rainer@krugs.de> wrote:

The easiest might be to checkout the tests before usage. How can I check
them out from svn and in which folder are they located? But I assume
they have to be compiled before usage?

What needs to be compiled should (i.e. is) compiled during compilation (not ideal actually, but good enough). Most of the tests code is written in Python. The tests are part of the main source code. If you have source code from Subversion, browse it and look for testsuite directories. Every testsuite directory is a set of tests for its parent directory.

Examples:

https://trac.osgeo.org/grass/browser/grass/trunk/raster/r.mapcalc/testsuite
https://trac.osgeo.org/grass/browser/grass/trunk/raster/r.viewshed/testsuite
https://trac.osgeo.org/grass/browser/grass/trunk/lib/python/script/testsuite

Vaclav Petras <wenzeslaus@gmail.com> writes:

On Thu, Aug 20, 2015 at 10:25 AM, Rainer M Krug <Rainer@krugs.de> wrote:

The easiest might be to checkout the tests before usage. How can I check
them out from svn and in which folder are they located? But I assume
they have to be compiled before usage?

What needs to be compiled should (i.e. is) compiled during compilation (not
ideal actually, but good enough). Most of the tests code is written in
Python. The tests are part of the main source code. If you have source code
from Subversion, browse it and look for testsuite directories. Every
testsuite directory is a set of tests for its parent directory.

Examples:

https://trac.osgeo.org/grass/browser/grass/trunk/raster/r.mapcalc/testsuite
https://trac.osgeo.org/grass/browser/grass/trunk/raster/r.viewshed/testsuite
https://trac.osgeo.org/grass/browser/grass/trunk/lib/python/script/testsuite

Thanks for the info - much clearer now. I also found [1] and the
script - as I assume that it runs the same tests, only that the I have a
little bit more control about the locations, I think I will go with the
script and adapt it to my needs.

Thanks a lot,

Rainer

Footnotes:
[1] https://grass.osgeo.org/grass71/manuals/libpython/gunittest_running_tests.html

--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax : +33 - (0)9 58 10 27 44

Fax (D): +49 - (0)3 21 21 25 22 44

email: Rainer@krugs.de

Skype: RMkrug

PGP: 0x0F52F982