mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-07 20:26:54 +00:00
testing for two new hooks
changed name of testing files folder for testing samples... updated all paths using it
This commit is contained in:
parent
04d965a6a5
commit
23dfdc438c
40 changed files with 86 additions and 3 deletions
|
|
@ -6,7 +6,7 @@ omit =
|
||||||
.tox/*
|
.tox/*
|
||||||
/usr/*
|
/usr/*
|
||||||
setup.py
|
setup.py
|
||||||
pre_commit_hooks/loaderon_hooks/tests/automatic_testing/testing_files/*
|
pre_commit_hooks/loaderon_hooks/tests/automatic_testing/testing_samples/*
|
||||||
|
|
||||||
[report]
|
[report]
|
||||||
show_missing = True
|
show_missing = True
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ def test_with_pylint_error():
|
||||||
|
|
||||||
|
|
||||||
def walk_return(folder_path):
|
def walk_return(folder_path):
|
||||||
root = '/home/administrador/Escritorio/pre-commit-hooks/pre_commit_hooks/loaderon_hooks/tests/automatic_testing/testing_files/check_using_pylint_samples'
|
root = '/home/administrador/Escritorio/pre-commit-hooks/pre_commit_hooks/loaderon_hooks/tests/automatic_testing/testing_samples/check_using_pylint_samples'
|
||||||
unused_dirs = []
|
unused_dirs = []
|
||||||
files = ['.pylintrc']
|
files = ['.pylintrc']
|
||||||
return [(root, unused_dirs, files)]
|
return [(root, unused_dirs, files)]
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from pre_commit_hooks.loaderon_hooks.odoo_specific_hooks.check_model_name import main
|
||||||
|
from pre_commit_hooks.loaderon_hooks.tests.automatic_testing.util.test_helpers import \
|
||||||
|
perform_test_on_file_expecting_result
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def clean_sys_argv():
|
||||||
|
sys.argv = []
|
||||||
|
yield
|
||||||
|
|
||||||
|
|
||||||
|
def test_check_model_name_ok():
|
||||||
|
perform_test_on_file_expecting_result('check_model_name_samples/ok.py', main)
|
||||||
|
|
||||||
|
|
||||||
|
def test_check_model_name_multiple_inheritance_ok():
|
||||||
|
perform_test_on_file_expecting_result('check_model_name_samples/multiple_inheritance_ok.py', main)
|
||||||
|
|
||||||
|
|
||||||
|
def test_check_model_name_error():
|
||||||
|
perform_test_on_file_expecting_result('check_model_name_samples/error.py', main, expected_result=2)
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from pre_commit_hooks.loaderon_hooks.odoo_specific_hooks.check_view_fields_order import main
|
||||||
|
from pre_commit_hooks.loaderon_hooks.tests.automatic_testing.util.test_helpers import \
|
||||||
|
perform_test_on_file_expecting_result
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def clean_sys_argv():
|
||||||
|
sys.argv = []
|
||||||
|
yield
|
||||||
|
|
||||||
|
|
||||||
|
def test_check_view_fields_order_ok():
|
||||||
|
perform_test_on_file_expecting_result('check_view_fields_order_samples/ok.xml', main)
|
||||||
|
|
||||||
|
|
||||||
|
def test_check_view_fields_order_name_error():
|
||||||
|
perform_test_on_file_expecting_result('check_view_fields_order_samples/first_field_not_name_error.xml', main, expected_result=2)
|
||||||
|
|
||||||
|
|
||||||
|
def test_check_view_fields_order_model_error():
|
||||||
|
perform_test_on_file_expecting_result('check_view_fields_order_samples/second_field_not_model_error.xml', main, expected_result=2)
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
class SomeClass(object):
|
||||||
|
_name = "some.model.name"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
class SomeClass(object):
|
||||||
|
_inherit = ['some_model_name', 'some_other_model_name']
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
class SomeClass(object):
|
||||||
|
_name = "testing_files.some.model.name"
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
<record id="id" model="ir.ui.view">
|
||||||
|
<field name="not-name-tag">Jhon Doe</field>
|
||||||
|
<field name="model">some.model</field>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
<record id="id" model="ir.ui.view">
|
||||||
|
<field name="name">some.model.form.inherit</field>
|
||||||
|
<field name="not-model-tag">Jhon Doe</field>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
<record id="id" model="ir.ui.view">
|
||||||
|
<field name="name">some.model.form.inherit</field>
|
||||||
|
<field name="model">some.model</field>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
|
|
@ -4,7 +4,7 @@ import sys
|
||||||
|
|
||||||
def get_sample_file_path(file_name):
|
def get_sample_file_path(file_name):
|
||||||
current_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
current_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
testing_files_folder_path = current_path + '/testing_files/'
|
testing_files_folder_path = current_path + '/testing_samples/'
|
||||||
return testing_files_folder_path + file_name
|
return testing_files_folder_path + file_name
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue