Skip to content

Commit

Permalink
Add some basic docs. Remove pin for pytest; v4 should work ok
Browse files Browse the repository at this point in the history
  • Loading branch information
craigds committed Dec 10, 2018
1 parent b65c5d1 commit 7e62d38
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 42 deletions.
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ gdalinfo --version
Run autotest suite:
```
cd ../autotest
python run_all.py
pip install -r requirements.txt
pytest
```

Git workflows with GDAL
Expand Down
15 changes: 0 additions & 15 deletions autotest/README

This file was deleted.

56 changes: 56 additions & 0 deletions autotest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# GDAL test suite


## How to run tests

1. You need to install `pytest` to run the test suite. This should do it:

```bash
cd autotest
pip install -r ./requirements.txt
```

2. Then, run tests with:

```bash
pytest
```

3. Some quick usage tips:

```bash
# get more verbose output; don't capture stdout/stdin
pytest -vvs

# run all the gcore tests
pytest gcore/

# run a particular module only
pytest gcore/basic_test.py
```


## GDAL's tests are not independent

GDAL's test functions are not currently independent of each other. In particular, running individual test functions from a given module may not work. Most tests were originally written with the assumption that entire modules will be run at once.

Practically, this means that you should avoid using:


* pytest's `--last-failed` / `--lf` option (since it runs only failed tests, not the whole module)
* test specifiers that run individual tests (e.g. `pytest gcore/basic_test.py::test_basic_test_1` )
* the xunit plugin to run tests in parallel, unless you also use `--dist=loadfile`. (This may have other issues; untested)

This will hopefully be addressed in the future. When writing new tests, please try to make them independent of each other.


## Notes about availability of GDAL sample and test data

The GDAL Team makes every effort to assure that all sample data files
available from GDAL download server (http://download.osgeo.org/gdal/data/) and
test data files used in GDAL Autotest package (https://github.com/OSGeo/gdal/tree/master/autotest)
are available as public and freely redistributable geodata.

--

http://gdal.org/
2 changes: 1 addition & 1 deletion autotest/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pytest>=3,<3.10
pytest>=3
pytest-sugar
25 changes: 0 additions & 25 deletions autotest/virtualenv-setup.sh

This file was deleted.

10 changes: 10 additions & 0 deletions gdal/scripts/vagrant/gdal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,13 @@ make generate
make
make vagrant_safe_test
cd ../..

# Install pytest.
# First install pip 9, which is the last version which can upgrade the system's `six`
# 10+ throws an error :/
curl https://bootstrap.pypa.io/get-pip.py 'pip<10' | sudo -H python

sudo -H pip install -Ur /vagrant/autotest/requirements.txt

# Add python symbols so gdb is friendlier
sudo apt-get install -y python2.7-dbg

0 comments on commit 7e62d38

Please sign in to comment.