diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 9575169..c784232 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -66,22 +66,7 @@ Ready to contribute? Here's how to set up ``meza`` for local development. git clone git@github.com:/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 `_ 3. Create a branch for local development @@ -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 diff --git a/dev-requirements.txt b/dev-requirements.txt index 2046010..784251d 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -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 diff --git a/meza/convert.py b/meza/convert.py index dfb9594..42223fb 100644 --- a/meza/convert.py +++ b/meza/convert.py @@ -511,7 +511,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: @@ -530,7 +530,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) diff --git a/meza/io.py b/meza/io.py index 5a7f462..0f94ec1 100644 --- a/meza/io.py +++ b/meza/io.py @@ -199,18 +199,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' @@ -1568,7 +1568,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 diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..08a136d --- /dev/null +++ b/pytest.ini @@ -0,0 +1,5 @@ +[pytest] +norecursedirs=.tox .git +addopts= + --doctest-modules + --ignore manage.py diff --git a/setup.cfg b/setup.cfg index 2e8e2bc..ff6fd74 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,12 +4,6 @@ python_requires = >=3.8 [wheel] universal=1 -[nosetests] -verbosity=1 -# detailed-errors=1 -cover-package=meza -with-doctest=1 - [unittest] plugins=doctest process-restartworker=1 diff --git a/tox.ini b/tox.ini index 2ab612c..6d169fd 100644 --- a/tox.ini +++ b/tox.ini @@ -8,8 +8,8 @@ setenv = PYTHONWARNINGS=all commands = - !style: pytest - style: flake8 + !style: pytest {posargs} + style: flake8 {posargs} deps = -r{toxinidir}/dev-requirements.txt