Skip to content

Commit 4bb076c

Browse files
ragrawalragrawal
and
ragrawal
authored
switched to nox (#226)
* switched to nox * added test before publishing the package * updated readme" Co-authored-by: ragrawal <[email protected]>
1 parent 7f1e3bb commit 4bb076c

File tree

8 files changed

+72
-48
lines changed

8 files changed

+72
-48
lines changed

.circleci/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ jobs:
55
- image: circleci/python:3.6
66
steps:
77
- checkout
8-
- run: pip install --user tox
9-
- run: ~/.local/bin/tox
8+
- run: pip install --user nox
9+
- run: ~/.local/bin/nox
1010

1111
workflows:
1212
version: 2

.github/workflows/python-publish.yml

+23-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,32 @@
33

44
name: Upload Python Package
55

6-
on: [workflow_dispatch]
6+
on:
7+
workflow_dispatch:
8+
branches:
9+
- main
710

811
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: [3.6, 3.7, 3.8]
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v1
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install nox
27+
- name: Test with pytest
28+
run: nox
29+
930
deploy:
10-
31+
needs: test
1132
runs-on: ubuntu-latest
1233

1334
steps:

CONTRIBUTING.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
## Development environment and steps
44

5-
1. Install `tox` either globally or in a virtualenv: `pip install tox`.
6-
2. Click on the "Fork" button at the top-right of the GitHub page.
7-
3. Clone your fork. Example: `git clone [email protected]:dukebody/sklearn-pandas.git`.
8-
4. Create a new branch to work on the issue/feature you want.
9-
5. Hack out your code. To run the tests and `flake8`, just run `tox`. Tests live in the `tests` subfolder.
10-
6. Submit a new PR with your code, indicating in the PR which issue/feature it relates to.
5+
1. Click on the "Fork" button at the top-right of the GitHub page.
6+
2. Clone your fork. Example: `git clone [email protected]:dukebody/sklearn-pandas.git`.
7+
3. Create a new branch to work on the issue/feature you want.
8+
4. Hack out your code. To run the tests and `flake8`, just run `nox`. Tests live in the `tests` subfolder.
9+
5. Submit a new PR with your code, indicating in the PR which issue/feature it relates to.
1110

1211
Note: You don't need to install `sklearn-pandas` in your virtualenv to run the tests. `tox` will automatically create multiple virtual environments to run them with multiple package versions.
1312

README.rst

+4
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,10 @@ Below example shows how to change logging level.
451451
>>> import logging
452452
>>> logging.getLogger('sklearn_pandas').setLevel(logging.INFO)
453453

454+
Changes Not Yet Published
455+
---------
456+
457+
* Using nox for testing
454458

455459
Changelog
456460
---------

nox.ini

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[flake8]
2+
exclude =
3+
.git
4+
.github
5+
__pycache__
6+
build
7+
dist
8+
*site-packages/
9+
*bin/
10+
*.egg/*
11+
.eggs
12+
.tox
13+
docs

noxfile.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import nox
2+
3+
@nox.session
4+
def lint(session):
5+
session.install('pytest==5.3.5', 'setuptools==45.2',
6+
'wheel==0.34.2', 'flake8==3.7.9',
7+
'numpy==1.18.1', 'pandas==1.0.5')
8+
session.install('.')
9+
session.run('flake8', 'sklearn_pandas/', 'tests')
10+
11+
@nox.session
12+
@nox.parametrize('numpy', ['1.18.1', '1.19.4'])
13+
@nox.parametrize('scipy', ['1.4.1', '1.5.4'])
14+
@nox.parametrize('pandas', ['1.0.5', '1.1.4'])
15+
def tests(session, numpy, scipy, pandas):
16+
session.install('pytest==5.3.5',
17+
'setuptools==45.2',
18+
'wheel==0.34.2',
19+
f'numpy=={numpy}',
20+
f'scipy=={scipy}',
21+
f'pandas=={pandas}'
22+
)
23+
session.install('.')
24+
session.run('py.test', 'README.rst', 'tests')

tests/test_dataframe_mapper.py

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
# -*- coding: utf8 -*-
22

33
import pytest
4-
5-
# In py3, mock is included with the unittest standard library
6-
# In py2, it's a separate package
7-
try:
8-
from unittest.mock import Mock
9-
except ImportError:
10-
from mock import Mock
11-
4+
from unittest.mock import Mock
125
from pandas import DataFrame
136
import pandas as pd
147
from scipy import sparse

tox.ini

-30
This file was deleted.

0 commit comments

Comments
 (0)