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

Add acceptance tests #1360

Merged
merged 1 commit into from
Jul 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions pylint/test/acceptance/test_stdlib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/master/COPYING

import os
import zipfile

import pytest

import pylint.lint


def is_module(filename):
return filename.endswith(".py")


def is_package(filename, location):
return os.path.exists(os.path.join(location, filename, '__init__.py'))

LIB_DIRS = [
os.path.dirname(os.__file__),
os.path.dirname(zipfile.__file__)
]
MODULES_TO_CHECK = [(location, module) for location in LIB_DIRS for module in os.listdir(location)
if is_module(module) or is_package(module, location)]
MODULES_NAMES = [m[1] for m in MODULES_TO_CHECK]


@pytest.mark.acceptance
@pytest.mark.parametrize(("test_module_location", "test_module_name"),
MODULES_TO_CHECK, ids=MODULES_NAMES)
def test_libmodule(test_module_location, test_module_name):
os.chdir(test_module_location)
try:
pylint.lint.Run([test_module_name, '--enable=all'])
except SystemExit as ex:
assert ex.code != 32
return

assert False, "shouldn't get there"
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[pytest]
python_files=*test_*.py
addopts=-m "not acceptance"