Skip to content

Commit

Permalink
Merge pull request #669 from pganssle/contributing
Browse files Browse the repository at this point in the history
Updated testing information in CONTRIBUTING
  • Loading branch information
pganssle committed Apr 12, 2018
2 parents 48ababa + 6e3793f commit 96916cc
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 25 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ dist/
# Test detritus
.tox/
.pytest_cache/
venv/
.venv/

# Autogenerated version information
dateutil/_version.py
Expand Down
62 changes: 37 additions & 25 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,42 +59,54 @@ Starting December 1, 2017, all contributions will be assumed to be released unde

All contributions before December 1, 2017 except those explicitly relicensed, are only under the 3-clause BSD license.

## Building and releasing

When you get the source, it does not contain the internal zoneinfo
database. To get (and update) the database, run the updatezinfo.py script. Make sure
that the zic command is in your path, and that you have network connectivity
to get the latest timezone information from IANA, or from [our mirror of the
IANA database](https://dateutil.github.io/tzdata/).

## Development Setup

Install the the dependencies for running the test suite using `pip` or `conda`.
### Using a virtual environment

### pip
It is advisable to work in a virtual environment for development of `dateutil`. This can be done using [virtualenv](https://virtualenv.pypa.io):

Run the following commands to create a [virtual environment](https://virtualenv.pypa.io) with all dependencies installed:
```bash
python -m virtualenv .venv # Create virtual environment in .venv directory
source .venv/bin/activate # Activate the virtual environment
```

python -m virtualenv .venv # Create virtual environment in .venv directory
. .venv/bin/activate # Activate the virtual environment
pip install -r requirements.txt # Install the dependencies
Alternatively you can create a [conda environment](https://conda.io/docs/user-guide/tasks/manage-environments.html):

### conda
```bash
conda create -n dateutil # Create a conda environment
# conda create -n dateutil python=3.6 # Or specify a version
source activate dateutil # Activate the conda environment
```

Run the following commands to create a [conda environment](https://conda.io) with all dependencies installed:
Once your virtual environment is created, install the library in development mode:

conda create -n dateutil # Create a conda environment
# conda create -n dateutil python=3.6 # or specify a version
source activate dateutil # Activate the conda environment
pip install -r requirements.txt # Install the dependencies
```bash
pip install -e .
```

This will allow scripts run in your virtual environment to use the version of `dateutil` in your local directory. If you also want to run the tests in your local directory, install the test dependencies:

```bash
pip install -r requirements-dev.txt
```

## Testing

dateutil has a comprehensive test suite, which can be run simply by running
`python -m pytest` in the project root. Note that if you don't have the internal
zoneinfo database, some tests will fail. Apart from that, all tests should pass.
The best way to test `dateutil` is to run `tox`. By default, `tox` will test against all supported versions of Python installed on your system. To limit the number of tests, run a specific subset of environments. For example, to run only on Python 2.7 and Python 3.6:

```bash
tox -e py27,py36
```

You can also pass arguments to `pytest` through `tox` by placing them after `--`:

```bash
tox -e py36 -- -m tzstr
```

This will pass the `-m tzstr` parameter to `pytest`, running only the tests with the `tzstr` mark.

To easily test dateutil against all supported Python versions, you can use
[tox](https://tox.readthedocs.io/en/latest/).
The tests can also be run directly by running `pytest` or `python -m pytest` in the root directory. This will be likely be less thorough but is often faster and is a good first pass to check your changes.

All GitHub pull requests are automatically tested using travis and appveyor.
All GitHub pull requests are automatically tested using [Travis](https://travis-ci.org/dateutil/dateutil/) and [Appveyor](https://ci.appveyor.com/project/dateutil/dateutil).

0 comments on commit 96916cc

Please sign in to comment.