Skip to content

Commit

Permalink
add py3
Browse files Browse the repository at this point in the history
grizz committed Feb 18, 2018
1 parent d986ebb commit 54bd1ef
Showing 9 changed files with 26 additions and 11 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -5,14 +5,15 @@ branches:
- gh-pages
env:
- TOX_ENV=py27
matrix:
fast_finish: true
before_install:
- sudo apt-get -qq update
install:
- python -m pip install -U pip
- pip install -U setuptools
- pip install tox
- pip install codecov
- pip install tox-travis codecov
script:
- tox -e $TOX_ENV
- tox
after_success:
- codecov
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -10,10 +10,11 @@
### Security


## [Unreleased]
## [0.2.0]
### Added
- RequestsData can use .input extensions
- add real_http option
- py3 support

### Changed
- requests status code is optional, defaults to 200
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
# pytest filedata

[![PyPI](https://img.shields.io/pypi/v/pytest-filedata.svg?maxAge=3600)](https://pypi.python.org/pypi/pytest-filedata)
[![PyPI](https://img.shields.io/pypi/pyversions/pytest-filedata.svg?maxAge=3600)](https://pypi.python.org/pypi/pytest-filedata)
[![Travis CI](https://img.shields.io/travis/20c/pytest-filedata.svg?maxAge=3600)](https://travis-ci.org/20c/pytest-filedata)
[![Code Health](https://landscape.io/github/20c/pytest-filedata/master/landscape.svg?style=flat)](https://landscape.io/github/20c/pytest-filedata/master)
[![Codecov](https://img.shields.io/codecov/c/github/20c/pytest-filedata/master.svg?maxAge=3600)](https://codecov.io/github/20c/pytest-filedata)
1 change: 1 addition & 0 deletions facsimile/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
decorator>=4, <5
future>=0.16.0, <1
requests-mock>=1, <2
10 changes: 7 additions & 3 deletions pytest_filedata/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@

from future import standard_library
standard_library.install_aliases()
from builtins import map
from builtins import object
import collections
from datetime import datetime
import json
import os
import urlparse
import urllib.parse

import requests_mock
import decorator
@@ -74,7 +78,7 @@ def get_test_files(dirname):
if not os.path.isdir(dirname):
return []
path = dirname + "/{}"
return map(path.format, sorted(os.listdir(dirname)))
return list(map(path.format, sorted(os.listdir(dirname))))


def get_filedata(name):
@@ -115,7 +119,7 @@ def __init__(self, prefix, real_http=False):
self.mocker = requests_mock.Mocker(adapter=adapter, real_http=real_http)

def callback(self, request, context):
path = urlparse.urlparse(request.url).path
path = urllib.parse.urlparse(request.url).path
path = os.path.join(test_dir, 'data', self.prefix, path.lstrip('/'))

files = get_test_files(path)
8 changes: 8 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -17,7 +17,15 @@
license='LICENSE.txt',
classifiers=[
'Development Status :: 4 - Beta',
'Framework :: Pytest',
'Topic :: Software Development :: Testing',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
packages = find_packages(),
include_package_data=True,
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -12,4 +12,4 @@ def pytest_generate_tests(metafunc):
for fixture in metafunc.fixturenames:
if fixture.startswith('data_'):
data = pytest.get_filedata(fixture)
metafunc.parametrize(fixture, data.values(), ids=data.keys())
metafunc.parametrize(fixture, list(data.values()), ids=list(data.keys()))
1 change: 1 addition & 0 deletions tests/test_filedata.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-

from __future__ import print_function
import pytest


4 changes: 1 addition & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@

[tox]
envlist = py27
envlist = py{27,34,35,36}

[testenv]
passenv = CI TRAVIS*
commands = py.test --cov-report=term-missing --cov-report=xml --cov={envsitepackagesdir}/pytest_filedata
codecov -e TOXENV
deps = -r{toxinidir}/facsimile/requirements.txt
-r{toxinidir}/facsimile/requirements-test.txt

[pytest]
norecursedirs = .facsimile data gen .tox

0 comments on commit 54bd1ef

Please sign in to comment.