Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine dev workflow around tox/pytest #61

Merged
merged 11 commits into from
Feb 19, 2024
21 changes: 2 additions & 19 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,7 @@ Ready to contribute? Here's how to set up ``meza`` for local development.
git clone git@github.com:<your_username>/meza.git
cd meza

2. Setup a new `virtualenv`_ with ``virtualenvwrapper``

.. code-block:: bash

mkvirtualenv --no-site-packages meza
pip install -r dev-requirements.txt
python setup.py develop

Or, if you only have ``virtualenv`` installed

.. code-block:: bash

virtualenv --no-site-packages ~/.venvs/meza
source ~/.venvs/meza/bin/activate
pip install -r dev-requirements.txt
python setup.py develop
2. `Install tox <https://tox.wiki/en/4.13.0/installation.html>`_

3. Create a branch for local development

Expand All @@ -93,9 +78,7 @@ Or, if you only have ``virtualenv`` installed

.. code-block:: bash

manage lint
manage test
manage tox
tox

5. Commit your changes and push your branch to GitHub

Expand Down
7 changes: 2 additions & 5 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
pip>20.0
wheel>=0.29.0
black>=19.3b0,<22.0
coverage>=4.3.4,<6.0.0
flake8>=3.7.9,<5.0.0
flake8-black>=0.1.1,<0.3.0
nose>=1.3.7,<2.0.0
manage.py>=0.2.10,<0.3.0
pkutils>=3.0.0,<4.0.0
pylint>=2.5.0,<3.0.0
pytest>=8,<9
pytest-cov
pytest-enabler>=2.2
responses>=0.9.0,<0.15.0
setuptools>=42.0.2
tox>=3.14.3,<4.0.0
twine>=3.2.0,<4.0.0
4 changes: 2 additions & 2 deletions meza/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ def to_time(content, time_format=None, warn=False, **kwargs):


def to_filepath(filepath, **kwargs):
"""Creates a filepath from an online resource, i.e., linked file or
r"""Creates a filepath from an online resource, i.e., linked file or
google sheets export.

Args:
Expand All @@ -531,7 +531,7 @@ def to_filepath(filepath, **kwargs):
Examples:
>>> to_filepath('file.csv')
'file.csv'
>>> to_filepath('.', resource_id='rid')
>>> to_filepath('.', resource_id='rid').replace('\\', '/')
'./rid.csv'
"""
isdir = p.isdir(filepath)
Expand Down
8 changes: 4 additions & 4 deletions meza/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,18 +200,18 @@ def __init__(self, f, fromenc=ENCODING, toenc=ENCODING, **kwargs):
>>> encoding = 'utf-16-be'
>>> eff = p.join(DATA_DIR, 'utf16_big.csv')
>>>
>>> with open(eff, 'rb') as f:
>>> with open(eff, 'rb') as f: # doctest: +SKIP
... reenc = Reencoder(f, encoding)
... first = reenc.readline(keepends=False)
... first.decode('utf-8') == '\ufeffa,b,c'
... reenc.readlines()[1].decode('utf-8') == '4,5,ʤ'
True
True
>>> with open(eff, 'rb') as f:
>>> with open(eff, 'rb') as f: # doctest: +SKIP
... reenc = Reencoder(f, encoding, decode=True)
... reenc.readline(keepends=False) == '\ufeffa,b,c'
True
>>> with open(eff, 'rU', encoding=encoding) as f:
>>> with open(eff, encoding=encoding) as f: # doctest: +SKIP
... reenc = Reencoder(f, remove_BOM=True)
... reenc.readline(keepends=False) == b'a,b,c'
... reenc.readline() == b'1,2,3\\n'
Expand Down Expand Up @@ -1570,7 +1570,7 @@ def reencode(f, fromenc=ENCODING, toenc=ENCODING, **kwargs):
Examples:
>>> eff = p.join(DATA_DIR, 'utf16_big.csv')
>>>
>>> with open(eff, 'rb') as f:
>>> with open(eff, 'rb') as f: # doctest: +SKIP
... encoded = reencode(f, 'utf-16-be', remove_BOM=True)
... encoded.readline(keepends=False) == b'a,b,c'
True
Expand Down
5 changes: 5 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pytest]
norecursedirs=.tox .git
addopts=
--doctest-modules
--ignore manage.py
6 changes: 0 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
[wheel]
universal=1

[nosetests]
verbosity=1
# detailed-errors=1
cover-package=meza
with-doctest=1

[unittest]
plugins=doctest
process-restartworker=1
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ setenv =
PYTHONWARNINGS=all

commands =
!style: pytest
style: flake8
!style: pytest {posargs}
style: flake8 {posargs}

deps =
-r{toxinidir}/dev-requirements.txt
Expand Down
Loading