diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000000..65def8fcf1c --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,252 @@ +version: 2 + +jobs: + # Core + "python-2.7-core": + docker: + - image: circleci/python:2.7-stretch-node-browsers + environment: + PLOTLY_TOX_PYTHON_27: python2.7 + + steps: + - checkout + - run: + name: Install tox + command: 'sudo pip install tox' + - run: + name: Test with tox + command: 'tox -e py27-core' + no_output_timeout: 20m + + "python-3.4-core": + docker: + - image: circleci/python:3.4-stretch-node-browsers + environment: + PLOTLY_TOX_PYTHON_34: python3.4 + + steps: + - checkout + - run: + name: Install tox + command: 'sudo pip install tox' + - run: + name: Test with tox + command: 'tox -e py34-core' + no_output_timeout: 20m + + "python-3.5-core": + docker: + - image: circleci/python:3.5-stretch-node-browsers + environment: + PLOTLY_TOX_PYTHON_35: python3.5 + + steps: + - checkout + - run: + name: Install tox + command: 'sudo pip install tox' + - run: + name: Test with tox + command: 'tox -e py35-core' + no_output_timeout: 20m + + "python-3.6-core": + docker: + - image: circleci/python:3.6-stretch-node-browsers + environment: + PLOTLY_TOX_PYTHON_36: python3.6 + + steps: + - checkout + - run: + name: Install tox + command: 'sudo pip install tox' + - run: + name: Test with tox + command: 'tox -e py36-core' + no_output_timeout: 20m + + "python-3.7-core": + docker: + - image: circleci/python:3.7-stretch-node-browsers + environment: + PLOTLY_TOX_PYTHON_37: python3.7 + + steps: + - checkout + - run: + name: Install tox + command: 'sudo pip install tox' + - run: + name: Test with tox + command: 'tox -e py37-core' + no_output_timeout: 20m + + # Optional + "python-2.7-optional": + docker: + - image: circleci/python:2.7-stretch-node-browsers + environment: + PLOTLY_TOX_PYTHON_27: python2.7 + + steps: + - checkout + - run: + name: Install tox + command: 'sudo pip install tox' + - run: + name: Install npm dependencies + command: cd plotly/tests/test_optional/test_jupyter && npm install + no_output_timeout: 20m + - run: + name: Test with tox + command: 'tox -e py27-optional' + no_output_timeout: 20m + + "python-3.4-optional": + docker: + - image: circleci/python:3.4-stretch-node-browsers + environment: + PLOTLY_TOX_PYTHON_34: python3.4 + + steps: + - checkout + - run: + name: Install tox + command: 'sudo pip install tox' + - run: + name: Install npm dependencies + command: cd plotly/tests/test_optional/test_jupyter && npm install + no_output_timeout: 20m + - run: + name: Test with tox + command: 'tox -e py34-optional' + no_output_timeout: 20m + + "python-3.5-optional": + docker: + - image: circleci/python:3.5-stretch-node-browsers + environment: + PLOTLY_TOX_PYTHON_35: python3.5 + + steps: + - checkout + - run: + name: Install tox + command: 'sudo pip install tox' + - run: + name: Install npm dependencies + command: cd plotly/tests/test_optional/test_jupyter && npm install + no_output_timeout: 20m + - run: + name: Test with tox + command: 'tox -e py35-optional' + no_output_timeout: 20m + + "python-3.6-optional": + docker: + - image: circleci/python:3.6-stretch-node-browsers + environment: + PLOTLY_TOX_PYTHON_36: python3.6 + + steps: + - checkout + - run: + name: Install tox + command: 'sudo pip install tox' + - run: + name: Install npm dependencies + command: cd plotly/tests/test_optional/test_jupyter && npm install + no_output_timeout: 20m + - run: + name: Test with tox + command: 'tox -e py36-optional' + no_output_timeout: 20m + + "python-3.7-optional": + docker: + - image: circleci/python:3.7-stretch-node-browsers + environment: + PLOTLY_TOX_PYTHON_37: python3.7 + + steps: + - checkout + - run: + name: Install tox + command: 'sudo pip install tox' + - run: + name: Install npm dependencies + command: cd plotly/tests/test_optional/test_jupyter && npm install + no_output_timeout: 20m + - run: + name: Test with tox + command: 'tox -e py37-optional' + no_output_timeout: 20m + + # Plot.ly + "python-2.7-plot_ly": + docker: + - image: circleci/python:2.7-stretch-node-browsers + environment: + PLOTLY_TOX_PYTHON_27: python2.7 + + steps: + - checkout + - run: + name: Install tox + command: 'sudo pip install tox' + - run: + name: Test with tox + command: 'tox -e py27-plot_ly' + no_output_timeout: 20m + + "python-3.4-plot_ly": + docker: + - image: circleci/python:3.4-stretch-node-browsers + environment: + PLOTLY_TOX_PYTHON_34: python3.4 + + steps: + - checkout + - run: + name: Install tox + command: 'sudo pip install tox' + - run: + name: Test with tox + command: 'tox -e py34-plot_ly' + no_output_timeout: 20m + + "python-3.7-plot_ly": + docker: + - image: circleci/python:3.7-stretch-node-browsers + environment: + PLOTLY_TOX_PYTHON_37: python3.7 + + steps: + - checkout + - run: + name: Install tox + command: 'sudo pip install tox' + - run: + name: Test with tox + command: 'tox -e py37-plot_ly' + no_output_timeout: 20m + +workflows: + version: 2 + build: + jobs: + - "python-2.7-core" + - "python-3.4-core" + - "python-3.5-core" + - "python-3.6-core" + - "python-3.7-core" + - "python-2.7-optional" + - "python-3.4-optional" + - "python-3.5-optional" + - "python-3.6-optional" + # 3.7 optional disabled due to current shapely incompatibility + # - "python-3.7-optional" + - "python-2.7-plot_ly" + - "python-3.4-plot_ly" + - "python-3.7-plot_ly" diff --git a/plotly/tests/test_core/test_api/test_v1/__init__.py b/_plotly_utils/tests/__init__.py similarity index 100% rename from plotly/tests/test_core/test_api/test_v1/__init__.py rename to _plotly_utils/tests/__init__.py diff --git a/plotly/tests/test_core/test_api/test_v2/__init__.py b/_plotly_utils/tests/validators/__init__.py similarity index 100% rename from plotly/tests/test_core/test_api/test_v2/__init__.py rename to _plotly_utils/tests/validators/__init__.py diff --git a/_plotly_utils/tests/validators/test_angle_validator.py b/_plotly_utils/tests/validators/test_angle_validator.py index 7224e35d30f..e6b42fb0400 100644 --- a/_plotly_utils/tests/validators/test_angle_validator.py +++ b/_plotly_utils/tests/validators/test_angle_validator.py @@ -1,4 +1,5 @@ import pytest +#from ..basevalidators import AngleValidator from _plotly_utils.basevalidators import AngleValidator import numpy as np @@ -33,7 +34,7 @@ def test_coercion(val, expected, validator): # ### Test rejection ### @pytest.mark.parametrize('val', ['hello', (), [], [1, 2, 3], set(), '34']) -def test_rejection(val, validator: AngleValidator): +def test_rejection(val, validator): with pytest.raises(ValueError) as validation_failure: validator.validate_coerce(val) diff --git a/_plotly_utils/tests/validators/test_any_validator.py b/_plotly_utils/tests/validators/test_any_validator.py index 9dddc9f1c3f..67a3b0b88a5 100644 --- a/_plotly_utils/tests/validators/test_any_validator.py +++ b/_plotly_utils/tests/validators/test_any_validator.py @@ -21,7 +21,7 @@ def validator_aok(): @pytest.mark.parametrize('val', [ set(), 'Hello', 123, np.inf, np.nan, {} ]) -def test_acceptance(val, validator: AnyValidator): +def test_acceptance(val, validator): assert validator.validate_coerce(val) is val @@ -36,7 +36,7 @@ def test_acceptance(val, validator: AnyValidator): ['Hello', 'World'], [np.pi, np.e, {}] ]) -def test_acceptance_array(val, validator_aok: AnyValidator): +def test_acceptance_array(val, validator_aok): coerce_val = validator_aok.validate_coerce(val) if isinstance(val, np.ndarray): assert isinstance(coerce_val, np.ndarray) diff --git a/_plotly_utils/tests/validators/test_basetraces_validator.py b/_plotly_utils/tests/validators/test_basetraces_validator.py index a3e39274139..fa8fa6168a1 100644 --- a/_plotly_utils/tests/validators/test_basetraces_validator.py +++ b/_plotly_utils/tests/validators/test_basetraces_validator.py @@ -16,7 +16,7 @@ def validator(): # Tests # ----- -def test_acceptance(validator: BaseDataValidator): +def test_acceptance(validator): val = [Scatter(mode='lines'), Box(fillcolor='yellow')] res = validator.validate_coerce(val) res_present = validator.present(res) @@ -36,7 +36,7 @@ def test_acceptance(validator: BaseDataValidator): assert res_present[0].uid != res_present[1].uid -def test_acceptance_dict(validator: BaseDataValidator): +def test_acceptance_dict(validator): val = (dict(type='scatter', mode='lines'), dict(type='box', fillcolor='yellow')) res = validator.validate_coerce(val) @@ -56,7 +56,7 @@ def test_acceptance_dict(validator: BaseDataValidator): assert res_present[0].uid != res_present[1].uid -def test_default_is_scatter(validator: BaseDataValidator): +def test_default_is_scatter(validator): val = [dict(mode='lines')] res = validator.validate_coerce(val) res_present = validator.present(res) @@ -68,7 +68,7 @@ def test_default_is_scatter(validator: BaseDataValidator): assert res_present[0].mode == 'lines' -def test_rejection_type(validator: BaseDataValidator): +def test_rejection_type(validator): val = 37 with pytest.raises(ValueError) as validation_failure: @@ -77,7 +77,7 @@ def test_rejection_type(validator: BaseDataValidator): assert "Invalid value" in str(validation_failure.value) -def test_rejection_element_type(validator: BaseDataValidator): +def test_rejection_element_type(validator): val = [42] with pytest.raises(ValueError) as validation_failure: @@ -86,7 +86,7 @@ def test_rejection_element_type(validator: BaseDataValidator): assert "Invalid element(s)" in str(validation_failure.value) -def test_rejection_element_attr(validator: BaseDataValidator): +def test_rejection_element_attr(validator): val = [dict(type='scatter', bogus=99)] with pytest.raises(ValueError) as validation_failure: @@ -97,7 +97,7 @@ def test_rejection_element_attr(validator: BaseDataValidator): str(validation_failure.value)) -def test_rejection_element_tracetype(validator: BaseDataValidator): +def test_rejection_element_tracetype(validator): val = [dict(type='bogus', a=4)] with pytest.raises(ValueError) as validation_failure: diff --git a/_plotly_utils/tests/validators/test_color_validator.py b/_plotly_utils/tests/validators/test_color_validator.py index a8bcf73ce87..c83947204ee 100644 --- a/_plotly_utils/tests/validators/test_color_validator.py +++ b/_plotly_utils/tests/validators/test_color_validator.py @@ -30,14 +30,14 @@ def validator_aok_colorscale(): @pytest.mark.parametrize('val', ['red', 'BLUE', 'rgb(255, 0, 0)', 'hsl(0, 100%, 50%)', 'hsla(0, 100%, 50%, 100%)', 'hsv(0, 100%, 100%)', 'hsva(0, 100%, 100%, 50%)']) -def test_acceptance(val, validator: ColorValidator): +def test_acceptance(val, validator): assert validator.validate_coerce(val) == val # ### Rejection by type ### @pytest.mark.parametrize('val', [set(), 23, 0.5, {}, ['red'], [12]]) -def test_rejection(val, validator: ColorValidator): +def test_rejection(val, validator): with pytest.raises(ValueError) as validation_failure: validator.validate_coerce(val) @@ -47,7 +47,7 @@ def test_rejection(val, validator: ColorValidator): # ### Rejection by value ### @pytest.mark.parametrize('val', ['redd', 'rgbbb(255, 0, 0)', 'hsl(0, 1%0000%, 50%)']) -def test_rejection(val, validator: ColorValidator): +def test_rejection(val, validator): with pytest.raises(ValueError) as validation_failure: validator.validate_coerce(val) @@ -60,14 +60,14 @@ def test_rejection(val, validator: ColorValidator): @pytest.mark.parametrize('val', ['red', 'BLUE', 23, 15, 'rgb(255, 0, 0)', 'hsl(0, 100%, 50%)', 'hsla(0, 100%, 50%, 100%)', 'hsv(0, 100%, 100%)', 'hsva(0, 100%, 100%, 50%)']) -def test_acceptance_colorscale(val, validator_colorscale: ColorValidator): +def test_acceptance_colorscale(val, validator_colorscale): assert validator_colorscale.validate_coerce(val) == val # ### Rejection by type ### @pytest.mark.parametrize('val', [set(), {}, ['red'], [12]]) -def test_rejection_colorscale(val, validator_colorscale: ColorValidator): +def test_rejection_colorscale(val, validator_colorscale): with pytest.raises(ValueError) as validation_failure: validator_colorscale.validate_coerce(val) @@ -77,7 +77,7 @@ def test_rejection_colorscale(val, validator_colorscale: ColorValidator): # ### Rejection by value ### @pytest.mark.parametrize('val', ['redd', 'rgbbb(255, 0, 0)', 'hsl(0, 1%0000%, 50%)']) -def test_rejection_colorscale(val, validator_colorscale: ColorValidator): +def test_rejection_colorscale(val, validator_colorscale): with pytest.raises(ValueError) as validation_failure: validator_colorscale.validate_coerce(val) @@ -94,7 +94,7 @@ def test_rejection_colorscale(val, validator_colorscale: ColorValidator): ['hsl(0, 100%, 50%)', 'hsla(0, 100%, 50%, 100%)', 'hsv(0, 100%, 100%)'], np.array(['hsl(0, 100%, 50%)', 'hsla(0, 100%, 50%, 100%)', 'hsv(0, 100%, 100%)']), ['hsva(0, 100%, 100%, 50%)']]) -def test_acceptance_aok(val, validator_aok: ColorValidator): +def test_acceptance_aok(val, validator_aok): coerce_val = validator_aok.validate_coerce(val) if isinstance(val, np.ndarray): @@ -111,7 +111,7 @@ def test_acceptance_aok(val, validator_aok: ColorValidator): [['red', 'rgb(255, 0, 0)'], ['hsl(0, 100%, 50%)', 'hsla(0, 100%, 50%, 100%)']], np.array([['red', 'rgb(255, 0, 0)'], ['hsl(0, 100%, 50%)', 'hsla(0, 100%, 50%, 100%)']]) ]) -def test_acceptance_aok_2D(val, validator_aok: ColorValidator): +def test_acceptance_aok_2D(val, validator_aok): coerce_val = validator_aok.validate_coerce(val) if isinstance(val, np.ndarray): @@ -128,7 +128,7 @@ def test_acceptance_aok_2D(val, validator_aok: ColorValidator): ['redd', 'rgb(255, 0, 0)'], ['hsl(0, 100%, 50_00%)', 'hsla(0, 100%, 50%, 100%)', 'hsv(0, 100%, 100%)'], ['hsva(0, 1%00%, 100%, 50%)']]) -def test_rejection_aok(val, validator_aok: ColorValidator): +def test_rejection_aok(val, validator_aok): with pytest.raises(ValueError) as validation_failure: validator_aok.validate_coerce(val) @@ -142,7 +142,7 @@ def test_rejection_aok(val, validator_aok: ColorValidator): [np.array(['hsl(0, 100%, 50_00%)', 'hsla(0, 100%, 50%, 100%)']), np.array(['hsv(0, 100%, 100%)', 'purple'])], [['blue'], [2]]]) -def test_rejection_aok_2D(val, validator_aok: ColorValidator): +def test_rejection_aok_2D(val, validator_aok): with pytest.raises(ValueError) as validation_failure: validator_aok.validate_coerce(val) @@ -157,7 +157,7 @@ def test_rejection_aok_2D(val, validator_aok: ColorValidator): ['red', 0.5, 'rgb(255, 0, 0)'], ['hsl(0, 100%, 50%)', 'hsla(0, 100%, 50%, 100%)', 'hsv(0, 100%, 100%)'], ['hsva(0, 100%, 100%, 50%)']]) -def test_acceptance_aok_colorscale(val, validator_aok_colorscale: ColorValidator): +def test_acceptance_aok_colorscale(val, validator_aok_colorscale): coerce_val = validator_aok_colorscale.validate_coerce(val) if isinstance(val, (list, np.ndarray)): assert np.array_equal(list(coerce_val), val) @@ -170,7 +170,7 @@ def test_acceptance_aok_colorscale(val, validator_aok_colorscale: ColorValidator [['redd', 0.5, 'rgb(255, 0, 0)'], ['hsl(0, 100%, 50_00%)', 'hsla(0, 100%, 50%, 100%)', 'hsv(0, 100%, 100%)'], ['hsva(0, 1%00%, 100%, 50%)']]) -def test_rejection_aok_colorscale(val, validator_aok_colorscale: ColorValidator): +def test_rejection_aok_colorscale(val, validator_aok_colorscale): with pytest.raises(ValueError) as validation_failure: validator_aok_colorscale.validate_coerce(val) @@ -180,25 +180,25 @@ def test_rejection_aok_colorscale(val, validator_aok_colorscale: ColorValidator) # Description # ----------- # Test dynamic description logic -def test_description(validator: ColorValidator): +def test_description(validator): desc = validator.description() assert 'A number that will be interpreted as a color' not in desc assert 'A list or array of any of the above' not in desc -def test_description_aok(validator_aok: ColorValidator): +def test_description_aok(validator_aok): desc = validator_aok.description() assert 'A number that will be interpreted as a color' not in desc assert 'A list or array of any of the above' in desc -def test_description_aok(validator_colorscale: ColorValidator): +def test_description_aok(validator_colorscale): desc = validator_colorscale.description() assert 'A number that will be interpreted as a color' in desc assert 'A list or array of any of the above' not in desc -def test_description_aok_colorscale(validator_aok_colorscale: ColorValidator): +def test_description_aok_colorscale(validator_aok_colorscale): desc = validator_aok_colorscale.description() assert 'A number that will be interpreted as a color' in desc assert 'A list or array of any of the above' in desc diff --git a/_plotly_utils/tests/validators/test_colorscale_validator.py b/_plotly_utils/tests/validators/test_colorscale_validator.py index fa2dda20e4d..f1b8f149a25 100644 --- a/_plotly_utils/tests/validators/test_colorscale_validator.py +++ b/_plotly_utils/tests/validators/test_colorscale_validator.py @@ -20,7 +20,7 @@ def named_colorscale(request): # Tests # ----- # ### Acceptance by name ### -def test_acceptance_named(named_colorscale, validator: ColorscaleValidator): +def test_acceptance_named(named_colorscale, validator): # As-is assert validator.validate_coerce(named_colorscale) == named_colorscale @@ -36,7 +36,7 @@ def test_acceptance_named(named_colorscale, validator: ColorscaleValidator): ((0.1, 'rgb(255,0,0)'), (0.3, 'green')), ((0, 'purple'), (0.2, 'yellow'), (1.0, 'rgba(255,0,0,100)')), ]) -def test_acceptance_array(val, validator: ColorscaleValidator): +def test_acceptance_array(val, validator): assert validator.validate_coerce(val) == val # ### Coercion as array ### @@ -45,7 +45,7 @@ def test_acceptance_array(val, validator: ColorscaleValidator): [(0.1, 'rgb(255, 0, 0)'), (0.3, 'GREEN')], (np.array([0, 'Purple'], dtype='object'), (0.2, 'yellow'), (1.0, 'RGBA(255,0,0,100)')), ]) -def test_acceptance_array(val, validator: ColorscaleValidator): +def test_acceptance_array(val, validator): # Compute expected (tuple of tuples where color is # lowercase with no spaces) expected = [[e[0], e[1]] for e in val] @@ -60,7 +60,7 @@ def test_acceptance_array(val, validator: ColorscaleValidator): @pytest.mark.parametrize('val', [ 23, set(), {}, np.pi ]) -def test_rejection_type(val, validator: ColorscaleValidator): +def test_rejection_type(val, validator): with pytest.raises(ValueError) as validation_failure: validator.validate_coerce(val) @@ -71,7 +71,7 @@ def test_rejection_type(val, validator: ColorscaleValidator): @pytest.mark.parametrize('val', [ 'Invalid', '' ]) -def test_rejection_str_value(val, validator: ColorscaleValidator): +def test_rejection_str_value(val, validator): with pytest.raises(ValueError) as validation_failure: validator.validate_coerce(val) @@ -87,7 +87,7 @@ def test_rejection_str_value(val, validator: ColorscaleValidator): ([0.1, 'purple'], [0.2, 123]), # Color not a string ([0.1, 'purple'], [0.2, 'yellowww']), # Invalid color string ]) -def test_rejection_array(val, validator: ColorscaleValidator): +def test_rejection_array(val, validator): with pytest.raises(ValueError) as validation_failure: validator.validate_coerce(val) diff --git a/_plotly_utils/tests/validators/test_compound_validator.py b/_plotly_utils/tests/validators/test_compound_validator.py index ba7b519ed8a..f5b26b8b5ad 100644 --- a/_plotly_utils/tests/validators/test_compound_validator.py +++ b/_plotly_utils/tests/validators/test_compound_validator.py @@ -14,7 +14,7 @@ def validator(): # Tests # ----- -def test_acceptance(validator: CompoundValidator): +def test_acceptance(validator): val = Marker(color='green', size=10) res = validator.validate_coerce(val) @@ -23,7 +23,7 @@ def test_acceptance(validator: CompoundValidator): assert res.size == 10 -def test_acceptance_none(validator: CompoundValidator): +def test_acceptance_none(validator): val = None res = validator.validate_coerce(val) @@ -32,7 +32,7 @@ def test_acceptance_none(validator: CompoundValidator): assert res.size is None -def test_acceptance_dict(validator: CompoundValidator): +def test_acceptance_dict(validator): val = dict(color='green', size=10) res = validator.validate_coerce(val) @@ -41,7 +41,7 @@ def test_acceptance_dict(validator: CompoundValidator): assert res.size == 10 -def test_rejection_type(validator: CompoundValidator): +def test_rejection_type(validator): val = 37 with pytest.raises(ValueError) as validation_failure: @@ -50,7 +50,7 @@ def test_rejection_type(validator: CompoundValidator): assert "Invalid value" in str(validation_failure.value) -def test_rejection_value(validator: CompoundValidator): +def test_rejection_value(validator): val = dict(color='green', size=10, bogus=99) with pytest.raises(ValueError) as validation_failure: diff --git a/_plotly_utils/tests/validators/test_compoundarray_validator.py b/_plotly_utils/tests/validators/test_compoundarray_validator.py index 0de5ef1848a..128d074ae5a 100644 --- a/_plotly_utils/tests/validators/test_compoundarray_validator.py +++ b/_plotly_utils/tests/validators/test_compoundarray_validator.py @@ -2,6 +2,7 @@ from _plotly_utils.basevalidators import CompoundArrayValidator from plotly.graph_objs.layout import Image + # Fixtures # -------- @pytest.fixture() @@ -13,7 +14,7 @@ def validator(): # Tests # ----- -def test_acceptance(validator: CompoundArrayValidator): +def test_acceptance(validator): val = [Image(opacity=0.5, sizex=120), Image(x=99)] res = validator.validate_coerce(val) res_present = validator.present(res) @@ -30,7 +31,7 @@ def test_acceptance(validator: CompoundArrayValidator): assert res_present[1].x == 99 -def test_acceptance_empty(validator: CompoundArrayValidator): +def test_acceptance_empty(validator): val = [{}] res = validator.validate_coerce(val) res_present = validator.present(res) @@ -43,7 +44,7 @@ def test_acceptance_empty(validator: CompoundArrayValidator): assert res_present[0].x is None -def test_acceptance_dict(validator: CompoundArrayValidator): +def test_acceptance_dict(validator): val = [dict(opacity=0.5, sizex=120), dict(x=99)] res = validator.validate_coerce(val) res_present = validator.present(res) @@ -61,7 +62,7 @@ def test_acceptance_dict(validator: CompoundArrayValidator): assert res_present[1].x == 99 -def test_rejection_type(validator: CompoundArrayValidator): +def test_rejection_type(validator): val = 37 with pytest.raises(ValueError) as validation_failure: @@ -70,7 +71,7 @@ def test_rejection_type(validator: CompoundArrayValidator): assert "Invalid value" in str(validation_failure.value) -def test_rejection_element(validator: CompoundArrayValidator): +def test_rejection_element(validator): val = ['a', 37] with pytest.raises(ValueError) as validation_failure: @@ -79,7 +80,7 @@ def test_rejection_element(validator: CompoundArrayValidator): assert "Invalid element(s)" in str(validation_failure.value) -def test_rejection_value(validator: CompoundArrayValidator): +def test_rejection_value(validator): val = [dict(opacity=0.5, sizex=120, bogus=100)] with pytest.raises(ValueError) as validation_failure: diff --git a/_plotly_utils/tests/validators/test_dataarray_validator.py b/_plotly_utils/tests/validators/test_dataarray_validator.py index 45bc6217033..b3bc03a13f0 100644 --- a/_plotly_utils/tests/validators/test_dataarray_validator.py +++ b/_plotly_utils/tests/validators/test_dataarray_validator.py @@ -16,7 +16,7 @@ def validator(): @pytest.mark.parametrize('val', [ [], [1], [''], (), ('Hello, ', 'world!'), ['A', 1, 'B', 0, 'C'] ]) -def test_validator_acceptance_simple(val, validator: DataArrayValidator): +def test_validator_acceptance_simple(val, validator): coerce_val = validator.validate_coerce(val) assert isinstance(coerce_val, list) assert validator.present(coerce_val) == tuple(val) @@ -25,7 +25,7 @@ def test_validator_acceptance_simple(val, validator: DataArrayValidator): @pytest.mark.parametrize('val', [ np.array([2, 3, 4]), pd.Series(['a', 'b', 'c']), np.array([[1, 2, 3], [4, 5, 6]]) ]) -def test_validator_acceptance_homogeneous(val, validator: DataArrayValidator): +def test_validator_acceptance_homogeneous(val, validator): coerce_val = validator.validate_coerce(val) assert isinstance(coerce_val, np.ndarray) assert np.array_equal(validator.present(coerce_val), val) @@ -35,7 +35,7 @@ def test_validator_acceptance_homogeneous(val, validator: DataArrayValidator): @pytest.mark.parametrize('val', [ 'Hello', 23, set(), {} ]) -def test_rejection(val, validator: DataArrayValidator): +def test_rejection(val, validator): with pytest.raises(ValueError) as validation_failure: validator.validate_coerce(val) diff --git a/_plotly_utils/tests/validators/test_flaglist_validator.py b/_plotly_utils/tests/validators/test_flaglist_validator.py index 3b4481c67f5..ac2a1ea1068 100644 --- a/_plotly_utils/tests/validators/test_flaglist_validator.py +++ b/_plotly_utils/tests/validators/test_flaglist_validator.py @@ -43,7 +43,7 @@ def extra(request): # Array not ok (with or without extras) # ------------------------------------- # ### Acceptance ### -def test_acceptance(flaglist, validator: FlaglistValidator): +def test_acceptance(flaglist, validator): assert validator.validate_coerce(flaglist) == flaglist @@ -60,7 +60,7 @@ def test_coercion(in_val, coerce_val, validator): # ### Rejection by type ### @pytest.mark.parametrize('val', [21, (), ['lines'], set(), {}]) -def test_rejection_type(val, validator: FlaglistValidator): +def test_rejection_type(val, validator): with pytest.raises(ValueError) as validation_failure: validator.validate_coerce(val) @@ -70,7 +70,7 @@ def test_rejection_type(val, validator: FlaglistValidator): # ### Rejection by value ### @pytest.mark.parametrize('val', ['', 'line', 'markers+line', 'lin es', 'lin es+markers']) -def test_rejection_val(val, validator: FlaglistValidator): +def test_rejection_val(val, validator): with pytest.raises(ValueError) as validation_failure: validator.validate_coerce(val) @@ -81,7 +81,7 @@ def test_rejection_val(val, validator: FlaglistValidator): # -------------------------- # ### Acceptance ### # Note: Acceptance of flaglists without extras already tested above -def test_acceptance_extra(extra, validator_extra: FlaglistValidator): +def test_acceptance_extra(extra, validator_extra): assert validator_extra.validate_coerce(extra) == extra @@ -101,7 +101,7 @@ def test_coercion(in_val, coerce_val, validator_extra): 'lines+all', # Extras cannot be combined with flags 'none+markers', 'markers+lines+text+none']) -def test_rejection_val(val, validator_extra: FlaglistValidator): +def test_rejection_val(val, validator_extra): with pytest.raises(ValueError) as validation_failure: validator_extra.validate_coerce(val) @@ -111,16 +111,16 @@ def test_rejection_val(val, validator_extra: FlaglistValidator): # Array OK (with extras) # ---------------------- # ### Acceptance (scalars) ### -def test_acceptance_aok_scalar_flaglist(flaglist, validator_extra_aok: FlaglistValidator): +def test_acceptance_aok_scalar_flaglist(flaglist, validator_extra_aok): assert validator_extra_aok.validate_coerce(flaglist) == flaglist -def test_acceptance_aok_scalar_extra(extra, validator_extra_aok: FlaglistValidator): +def test_acceptance_aok_scalar_extra(extra, validator_extra_aok): assert validator_extra_aok.validate_coerce(extra) == extra # ### Acceptance (lists) ### -def test_acceptance_aok_scalarlist_flaglist(flaglist, validator_extra_aok: FlaglistValidator): +def test_acceptance_aok_scalarlist_flaglist(flaglist, validator_extra_aok): assert np.array_equal(validator_extra_aok.validate_coerce([flaglist]), np.array([flaglist], dtype='unicode')) @@ -130,7 +130,7 @@ def test_acceptance_aok_scalarlist_flaglist(flaglist, validator_extra_aok: Flagl ['lines', 'lines+markers', 'markers+lines+text'], ['all', 'all', 'lines+text', 'none'] ]) -def test_acceptance_aok_list_flaglist(val, validator_extra_aok: FlaglistValidator): +def test_acceptance_aok_list_flaglist(val, validator_extra_aok): assert np.array_equal(validator_extra_aok.validate_coerce(val), np.array(val, dtype='unicode')) @@ -157,7 +157,7 @@ def test_coercion_aok(in_val, expected, validator_extra_aok): # ### Rejection by type ### @pytest.mark.parametrize('val', [21, set(), {}]) -def test_rejection_aok_type(val, validator_extra_aok: FlaglistValidator): +def test_rejection_aok_type(val, validator_extra_aok): with pytest.raises(ValueError) as validation_failure: validator_extra_aok.validate_coerce(val) @@ -170,7 +170,7 @@ def test_rejection_aok_type(val, validator_extra_aok: FlaglistValidator): ['lines', ()], ['none', set()], ['lines+text', {}, 'markers']]) -def test_rejection_aok_element_type(val, validator_extra_aok: FlaglistValidator): +def test_rejection_aok_element_type(val, validator_extra_aok): with pytest.raises(ValueError) as validation_failure: validator_extra_aok.validate_coerce(val) @@ -183,7 +183,7 @@ def test_rejection_aok_element_type(val, validator_extra_aok: FlaglistValidator) ['line', 'lines+markers', 'markers+lines+text'], # Invalid flag ['all', '', 'lines+text', 'none'] # Empty string ]) -def test_rejection_aok_element_val(val, validator_extra_aok: FlaglistValidator): +def test_rejection_aok_element_val(val, validator_extra_aok): with pytest.raises(ValueError) as validation_failure: validator_extra_aok.validate_coerce(val) diff --git a/_plotly_utils/tests/validators/test_imageuri_validator.py b/_plotly_utils/tests/validators/test_imageuri_validator.py index e78ebdf91ce..ff22cbaf1d2 100644 --- a/_plotly_utils/tests/validators/test_imageuri_validator.py +++ b/_plotly_utils/tests/validators/test_imageuri_validator.py @@ -20,12 +20,12 @@ def validator(): 'http://somewhere.com/images/image12.png', 'data:image/png;base64,iVBORw0KGgoAAAANSU', ]) -def test_validator_acceptance(val, validator: ImageUriValidator): +def test_validator_acceptance(val, validator): assert validator.validate_coerce(val) == val # ### Coercion from PIL Image ### -def test_validator_coercion_PIL(validator: ImageUriValidator): +def test_validator_coercion_PIL(validator): # Single pixel black png (http://png-pixel.com/) img_path = '_plotly_utils/tests/resources/1x1-black.png' diff --git a/_plotly_utils/tests/validators/test_infoarray_validator.py b/_plotly_utils/tests/validators/test_infoarray_validator.py index c7f7d8d18b5..11fd09860e1 100644 --- a/_plotly_utils/tests/validators/test_infoarray_validator.py +++ b/_plotly_utils/tests/validators/test_infoarray_validator.py @@ -32,7 +32,7 @@ def validator_number3_free(): @pytest.mark.parametrize('val', [ [1, 'A'], ('hello', 'world!'), [1, set()], [-1, 1] ]) -def test_validator_acceptance_any2(val, validator_any2: InfoArrayValidator): +def test_validator_acceptance_any2(val, validator_any2): coerce_val = validator_any2.validate_coerce(val) assert coerce_val == list(val) assert validator_any2.present(coerce_val) == tuple(val) @@ -42,7 +42,7 @@ def test_validator_acceptance_any2(val, validator_any2: InfoArrayValidator): @pytest.mark.parametrize('val', [ 'Not a list', 123, set(), {} ]) -def test_validator_rejection_any2_type(val, validator_any2: InfoArrayValidator): +def test_validator_rejection_any2_type(val, validator_any2): with pytest.raises(ValueError) as validation_failure: validator_any2.validate_coerce(val) @@ -53,7 +53,7 @@ def test_validator_rejection_any2_type(val, validator_any2: InfoArrayValidator): @pytest.mark.parametrize('val', [ [0, 1, 'A'], ('hello', 'world', '!'), [None, {}, []], [-1, 1, 9] ]) -def test_validator_rejection_any2_length(val, validator_any2: InfoArrayValidator): +def test_validator_rejection_any2_length(val, validator_any2): with pytest.raises(ValueError) as validation_failure: validator_any2.validate_coerce(val) @@ -66,7 +66,7 @@ def test_validator_rejection_any2_length(val, validator_any2: InfoArrayValidator @pytest.mark.parametrize('val', [ [1, 0, 0.5], (0.1, 0.4, 0.99), [1, 1, 0] ]) -def test_validator_acceptance_number3(val, validator_number3: InfoArrayValidator): +def test_validator_acceptance_number3(val, validator_number3): coerce_val = validator_number3.validate_coerce(val) assert coerce_val == list(val) assert validator_number3.present(coerce_val) == tuple(val) @@ -76,7 +76,7 @@ def test_validator_acceptance_number3(val, validator_number3: InfoArrayValidator @pytest.mark.parametrize('val', [ [1, 0], (0.1, 0.4, 0.99, 0.4), [1] ]) -def test_validator_rejection_number3_length(val, validator_number3: InfoArrayValidator): +def test_validator_rejection_number3_length(val, validator_number3): with pytest.raises(ValueError) as validation_failure: validator_number3.validate_coerce(val) @@ -89,7 +89,7 @@ def test_validator_rejection_number3_length(val, validator_number3: InfoArrayVal ((0.1, set(), 0.99), 1), ([[], '2', {}], 0) ]) -def test_validator_rejection_number3_length(val, first_invalid_ind, validator_number3: InfoArrayValidator): +def test_validator_rejection_number3_length(val, first_invalid_ind, validator_number3): with pytest.raises(ValueError) as validation_failure: validator_number3.validate_coerce(val) @@ -103,7 +103,7 @@ def test_validator_rejection_number3_length(val, first_invalid_ind, validator_nu ((0.1, -0.4, 0.99), 1), ([-1, 1, 0], 0) ]) -def test_validator_rejection_number3_length(val, first_invalid_ind, validator_number3: InfoArrayValidator): +def test_validator_rejection_number3_length(val, first_invalid_ind, validator_number3): with pytest.raises(ValueError) as validation_failure: validator_number3.validate_coerce(val) @@ -120,7 +120,7 @@ def test_validator_rejection_number3_length(val, first_invalid_ind, validator_nu np.array([0.1, 0.99]), [0], [] ]) -def test_validator_acceptance_number3_free(val, validator_number3_free: InfoArrayValidator): +def test_validator_acceptance_number3_free(val, validator_number3_free): coerce_val = validator_number3_free.validate_coerce(val) assert coerce_val == list(val) assert validator_number3_free.present(coerce_val) == tuple(val) @@ -130,7 +130,7 @@ def test_validator_acceptance_number3_free(val, validator_number3_free: InfoArra @pytest.mark.parametrize('val', [ 'Not a list', 123, set(), {} ]) -def test_validator_rejection_any2_type(val, validator_number3_free: InfoArrayValidator): +def test_validator_rejection_any2_type(val, validator_number3_free): with pytest.raises(ValueError) as validation_failure: validator_number3_free.validate_coerce(val) @@ -141,7 +141,7 @@ def test_validator_rejection_any2_type(val, validator_number3_free: InfoArrayVal @pytest.mark.parametrize('val', [ (0.1, 0.4, 0.99, 0.4), [1, 0, 0, 0, 0, 0, 0] ]) -def test_validator_rejection_number3_free_length(val, validator_number3_free: InfoArrayValidator): +def test_validator_rejection_number3_free_length(val, validator_number3_free): with pytest.raises(ValueError) as validation_failure: validator_number3_free.validate_coerce(val) @@ -154,7 +154,7 @@ def test_validator_rejection_number3_free_length(val, validator_number3_free: In ((0.1, set()), 1), ([[]], 0) ]) -def test_validator_rejection_number3_length(val, first_invalid_ind, validator_number3_free: InfoArrayValidator): +def test_validator_rejection_number3_length(val, first_invalid_ind, validator_number3_free): with pytest.raises(ValueError) as validation_failure: validator_number3_free.validate_coerce(val) diff --git a/_plotly_utils/tests/validators/test_integer_validator.py b/_plotly_utils/tests/validators/test_integer_validator.py index f88de843b6d..796622e3792 100644 --- a/_plotly_utils/tests/validators/test_integer_validator.py +++ b/_plotly_utils/tests/validators/test_integer_validator.py @@ -35,13 +35,13 @@ def validator_aok(request): # ### Acceptance ### @pytest.mark.parametrize('val', [1, -19, 0, -1234]) -def test_acceptance(val, validator: IntegerValidator): +def test_acceptance(val, validator): assert validator.validate_coerce(val) == val # ### Rejection by value ### @pytest.mark.parametrize('val', ['hello', (), [], [1, 2, 3], set(), '34', np.nan, np.inf, -np.inf]) -def test_rejection_by_value(val, validator: IntegerValidator): +def test_rejection_by_value(val, validator): with pytest.raises(ValueError) as validation_failure: validator.validate_coerce(val) @@ -52,13 +52,13 @@ def test_rejection_by_value(val, validator: IntegerValidator): # min == -1 and max == 2 @pytest.mark.parametrize('val', [0, 1, -1, 2]) -def test_acceptance_min_max(val, validator_min_max: IntegerValidator): +def test_acceptance_min_max(val, validator_min_max): assert validator_min_max.validate_coerce(val) == approx(val) @pytest.mark.parametrize('val', [-1.01, -10, 2.1, 3, np.iinfo(np.int).max, np.iinfo(np.int).min]) -def test_rejection_min_max(val, validator_min_max: IntegerValidator): +def test_rejection_min_max(val, validator_min_max): with pytest.raises(ValueError) as validation_failure: validator_min_max.validate_coerce(val) @@ -69,13 +69,13 @@ def test_rejection_min_max(val, validator_min_max: IntegerValidator): # min == -1 @pytest.mark.parametrize('val', [-1, 0, 1, 23, 99999]) -def test_acceptance_min(val, validator_min: IntegerValidator): +def test_acceptance_min(val, validator_min): assert validator_min.validate_coerce(val) == approx(val) @pytest.mark.parametrize('val', [-2, -123, np.iinfo(np.int).min]) -def test_rejection_min(val, validator_min: IntegerValidator): +def test_rejection_min(val, validator_min): with pytest.raises(ValueError) as validation_failure: validator_min.validate_coerce(val) @@ -86,13 +86,13 @@ def test_rejection_min(val, validator_min: IntegerValidator): # max == 2 @pytest.mark.parametrize('val', [1, 2, -10, -999999, np.iinfo(np.int32).min]) -def test_acceptance_max(val, validator_max: IntegerValidator): +def test_acceptance_max(val, validator_max): assert validator_max.validate_coerce(val) == approx(val) @pytest.mark.parametrize('val', [3, 10, np.iinfo(np.int32).max]) -def test_rejection_max(val, validator_max: IntegerValidator): +def test_rejection_max(val, validator_max): with pytest.raises(ValueError) as validation_failure: validator_max.validate_coerce(val) @@ -105,13 +105,13 @@ def test_rejection_max(val, validator_max: IntegerValidator): # ### Acceptance ### @pytest.mark.parametrize('val', [-2, 1, 0, 1, 10]) -def test_acceptance_aok_scalars(val, validator_aok: IntegerValidator): +def test_acceptance_aok_scalars(val, validator_aok): assert validator_aok.validate_coerce(val) == val @pytest.mark.parametrize('val', [[1, 0], [1], [-2, 1, 8], np.array([3, 2, -1, 5])]) -def test_acceptance_aok_list(val, validator_aok: IntegerValidator): +def test_acceptance_aok_list(val, validator_aok): assert np.array_equal(validator_aok.validate_coerce(val), val) @@ -122,7 +122,7 @@ def test_acceptance_aok_list(val, validator_aok: IntegerValidator): ((1, -1), (1, -1)), (np.array([-1, 0, 5.0], dtype='int16'), [-1, 0, 5]), (np.array([1, 0], dtype=np.int64), [1, 0])]) -def test_coercion_aok_list(val, expected, validator_aok: IntegerValidator): +def test_coercion_aok_list(val, expected, validator_aok): v = validator_aok.validate_coerce(val) if isinstance(val, np.ndarray): assert v.dtype == np.int32 @@ -136,7 +136,7 @@ def test_coercion_aok_list(val, expected, validator_aok: IntegerValidator): # @pytest.mark.parametrize('val', [['a', 4], [[], 3, 4]]) -def test_integer_validator_rejection_aok(val, validator_aok: IntegerValidator): +def test_integer_validator_rejection_aok(val, validator_aok): with pytest.raises(ValueError) as validation_failure: validator_aok.validate_coerce(val) @@ -146,7 +146,7 @@ def test_integer_validator_rejection_aok(val, validator_aok: IntegerValidator): # ### Rejection by element ### @pytest.mark.parametrize('val', [[-1, 11], [1.5, -3], [0, np.iinfo(np.int32).max], [0, np.iinfo(np.int32).min]]) -def test_rejection_aok_min_max(val, validator_aok: IntegerValidator): +def test_rejection_aok_min_max(val, validator_aok): with pytest.raises(ValueError) as validation_failure: validator_aok.validate_coerce(val) diff --git a/_plotly_utils/tests/validators/test_number_validator.py b/_plotly_utils/tests/validators/test_number_validator.py index 5c7d2887063..017e92432a0 100644 --- a/_plotly_utils/tests/validators/test_number_validator.py +++ b/_plotly_utils/tests/validators/test_number_validator.py @@ -37,14 +37,14 @@ def validator_aok(): # ### Acceptance ### @pytest.mark.parametrize('val', [1.0, 0.0, 1, -1234.5678, 54321, np.pi, np.nan, np.inf, -np.inf]) -def test_acceptance(val, validator: NumberValidator): +def test_acceptance(val, validator): assert validator.validate_coerce(val) == approx(val, nan_ok=True) # ### Rejection by value ### @pytest.mark.parametrize('val', ['hello', (), [], [1, 2, 3], set(), '34']) -def test_rejection_by_value(val, validator: NumberValidator): +def test_rejection_by_value(val, validator): with pytest.raises(ValueError) as validation_failure: validator.validate_coerce(val) @@ -54,13 +54,13 @@ def test_rejection_by_value(val, validator: NumberValidator): # ### With min/max ### @pytest.mark.parametrize('val', [0, 0.0, -0.5, 1, 1.0, 2, 2.0, np.pi/2.0]) -def test_acceptance_min_max(val, validator_min_max: NumberValidator): +def test_acceptance_min_max(val, validator_min_max): assert validator_min_max.validate_coerce(val) == approx(val) @pytest.mark.parametrize('val', [-1.01, -10, 2.1, 234, -np.inf, np.nan, np.inf]) -def test_rejection_min_max(val, validator_min_max: NumberValidator): +def test_rejection_min_max(val, validator_min_max): with pytest.raises(ValueError) as validation_failure: validator_min_max.validate_coerce(val) @@ -70,13 +70,13 @@ def test_rejection_min_max(val, validator_min_max: NumberValidator): # ### With min only ### @pytest.mark.parametrize('val', [0, 0.0, -0.5, 99999, np.inf]) -def test_acceptance_min(val, validator_min: NumberValidator): +def test_acceptance_min(val, validator_min): assert validator_min.validate_coerce(val) == approx(val) @pytest.mark.parametrize('val', [-1.01, -np.inf, np.nan]) -def test_rejection_min(val, validator_min: NumberValidator): +def test_rejection_min(val, validator_min): with pytest.raises(ValueError) as validation_failure: validator_min.validate_coerce(val) @@ -86,13 +86,13 @@ def test_rejection_min(val, validator_min: NumberValidator): # ### With max only ### @pytest.mark.parametrize('val', [0, 0.0, -np.inf, -123456, np.pi/2]) -def test_acceptance_max(val, validator_max: NumberValidator): +def test_acceptance_max(val, validator_max): assert validator_max.validate_coerce(val) == approx(val) @pytest.mark.parametrize('val', [2.01, np.inf, np.nan]) -def test_rejection_max(val, validator_max: NumberValidator): +def test_rejection_max(val, validator_max): with pytest.raises(ValueError) as validation_failure: validator_max.validate_coerce(val) @@ -104,13 +104,13 @@ def test_rejection_max(val, validator_max: NumberValidator): # ### Acceptance ### @pytest.mark.parametrize('val', [1.0, 0.0, 1, 0.4]) -def test_acceptance_aok_scalars(val, validator_aok: NumberValidator): +def test_acceptance_aok_scalars(val, validator_aok): assert validator_aok.validate_coerce(val) == val @pytest.mark.parametrize('val', [[1.0, 0.0], [1], [-0.1234, .41, -1.0]]) -def test_acceptance_aok_list(val, validator_aok: NumberValidator): +def test_acceptance_aok_list(val, validator_aok): assert np.array_equal(validator_aok.validate_coerce(val), np.array(val, dtype='float')) @@ -120,7 +120,7 @@ def test_acceptance_aok_list(val, validator_aok: NumberValidator): [([1.0, 0], (1.0, 0)), (np.array([1, -1]), np.array([1.0, -1.0])), ((-0.1234, 0, -1), (-0.1234, 0.0, -1.0))]) -def test_coercion_aok_list(val, expected, validator_aok: NumberValidator): +def test_coercion_aok_list(val, expected, validator_aok): v = validator_aok.validate_coerce(val) if isinstance(val, np.ndarray): assert v.dtype == 'float' @@ -134,7 +134,7 @@ def test_coercion_aok_list(val, expected, validator_aok: NumberValidator): # @pytest.mark.parametrize('val', [['a', 4]]) -def test_rejection_aok(val, validator_aok: NumberValidator): +def test_rejection_aok(val, validator_aok): with pytest.raises(ValueError) as validation_failure: validator_aok.validate_coerce(val) @@ -145,7 +145,7 @@ def test_rejection_aok(val, validator_aok: NumberValidator): @pytest.mark.parametrize('val', [[-1.6, 0.0], [1, 1.5, 2], [-0.1234, .41, np.nan], [0, np.inf], [0, -np.inf]]) -def test_rejection_aok_min_max(val, validator_aok: NumberValidator): +def test_rejection_aok_min_max(val, validator_aok): with pytest.raises(ValueError) as validation_failure: validator_aok.validate_coerce(val) diff --git a/_plotly_utils/tests/validators/test_string_validator.py b/_plotly_utils/tests/validators/test_string_validator.py index f857fbf013c..7d7256a196c 100644 --- a/_plotly_utils/tests/validators/test_string_validator.py +++ b/_plotly_utils/tests/validators/test_string_validator.py @@ -47,14 +47,14 @@ def validator_no_blanks_aok(): @pytest.mark.parametrize('val', ['bar', 234, np.nan, 'HELLO!!!', 'world!@#$%^&*()', '']) -def test_acceptance(val, validator: StringValidator): +def test_acceptance(val, validator): assert validator.validate_coerce(val) == str(val) # ### Rejection by value ### @pytest.mark.parametrize('val', [(), [], [1, 2, 3], set()]) -def test_rejection(val, validator: StringValidator): +def test_rejection(val, validator): with pytest.raises(ValueError) as validation_failure: validator.validate_coerce(val) @@ -65,13 +65,13 @@ def test_rejection(val, validator: StringValidator): # ------------ @pytest.mark.parametrize('val', ['foo', 'BAR', '']) -def test_acceptance_values(val, validator_values: StringValidator): +def test_acceptance_values(val, validator_values): assert validator_values.validate_coerce(val) == val @pytest.mark.parametrize('val', ['FOO', 'bar', 'other', '1234']) -def test_rejection_values(val, validator_values: StringValidator): +def test_rejection_values(val, validator_values): with pytest.raises(ValueError) as validation_failure: validator_values.validate_coerce(val) @@ -82,13 +82,13 @@ def test_rejection_values(val, validator_values: StringValidator): # ### No blanks ### @pytest.mark.parametrize('val', ['bar', 'HELLO!!!', 'world!@#$%^&*()']) -def test_acceptance_no_blanks(val, validator_no_blanks: StringValidator): +def test_acceptance_no_blanks(val, validator_no_blanks): assert validator_no_blanks.validate_coerce(val) == val @pytest.mark.parametrize('val', ['']) -def test_rejection_no_blanks(val, validator_no_blanks: StringValidator): +def test_rejection_no_blanks(val, validator_no_blanks): with pytest.raises(ValueError) as validation_failure: validator_no_blanks.validate_coerce(val) @@ -100,14 +100,14 @@ def test_rejection_no_blanks(val, validator_no_blanks: StringValidator): # ### Acceptance ### @pytest.mark.parametrize('val', ['bar', 'HELLO!!!', 'world!@#$%^&*()', '']) -def test_acceptance_strict(val, validator_strict: StringValidator): +def test_acceptance_strict(val, validator_strict): assert validator_strict.validate_coerce(val) == val # ### Rejection by value ### @pytest.mark.parametrize('val', [(), [], [1, 2, 3], set(), np.nan, np.pi, 23]) -def test_rejection_strict(val, validator_strict: StringValidator): +def test_rejection_strict(val, validator_strict): with pytest.raises(ValueError) as validation_failure: validator_strict.validate_coerce(val) @@ -119,7 +119,7 @@ def test_rejection_strict(val, validator_strict: StringValidator): # ### Acceptance ### @pytest.mark.parametrize('val', ['foo', 'BAR', '', 'baz']) -def test_acceptance_aok_scalars(val, validator_aok: StringValidator): +def test_acceptance_aok_scalars(val, validator_aok): assert validator_aok.validate_coerce(val) == val @@ -128,7 +128,7 @@ def test_acceptance_aok_scalars(val, validator_aok: StringValidator): ['foo'], np.array(['BAR', ''], dtype='object'), ['baz', 'baz', 'baz']]) -def test_acceptance_aok_list(val, validator_aok: StringValidator): +def test_acceptance_aok_list(val, validator_aok): coerce_val = validator_aok.validate_coerce(val) if isinstance(val, np.ndarray): assert isinstance(coerce_val, np.ndarray) @@ -143,7 +143,7 @@ def test_acceptance_aok_list(val, validator_aok: StringValidator): # ### Rejection by type ### @pytest.mark.parametrize('val', [['foo', ()], ['foo', 3, 4], [3, 2, 1]]) -def test_rejection_aok(val, validator_aok: StringValidator): +def test_rejection_aok(val, validator_aok): with pytest.raises(ValueError) as validation_failure: validator_aok.validate_coerce(val) @@ -153,7 +153,7 @@ def test_rejection_aok(val, validator_aok: StringValidator): # ### Rejection by value ### @pytest.mark.parametrize('val', [['foo', 'bar'], ['3', '4'], ['BAR', 'BAR', 'hello!']]) -def test_rejection_aok_values(val, validator_aok_values: StringValidator): +def test_rejection_aok_values(val, validator_aok_values): with pytest.raises(ValueError) as validation_failure: validator_aok_values.validate_coerce(val) @@ -166,7 +166,7 @@ def test_rejection_aok_values(val, validator_aok_values: StringValidator): ['bar', 'HELLO!!!'], np.array(['bar', 'HELLO!!!'], dtype='object'), ['world!@#$%^&*()']]) -def test_acceptance_no_blanks_aok(val, validator_no_blanks_aok: StringValidator): +def test_acceptance_no_blanks_aok(val, validator_no_blanks_aok): coerce_val = validator_no_blanks_aok.validate_coerce(val) if isinstance(val, np.ndarray): assert np.array_equal(coerce_val, @@ -184,7 +184,7 @@ def test_acceptance_no_blanks_aok(val, validator_no_blanks_aok: StringValidator) [''], np.array([''], dtype='object')]) def test_rejection_no_blanks_aok(val, - validator_no_blanks_aok: StringValidator): + validator_no_blanks_aok): with pytest.raises(ValueError) as validation_failure: validator_no_blanks_aok.validate_coerce(val) diff --git a/_plotly_utils/tests/validators/test_subplotid_validator.py b/_plotly_utils/tests/validators/test_subplotid_validator.py index be7358befe3..0dcb1fd3f34 100644 --- a/_plotly_utils/tests/validators/test_subplotid_validator.py +++ b/_plotly_utils/tests/validators/test_subplotid_validator.py @@ -14,7 +14,7 @@ def validator(): # ----- # ### Acceptance ### @pytest.mark.parametrize('val', ['geo'] + ['geo%d' % i for i in range(2, 10)]) -def test_acceptance(val, validator: SubplotidValidator): +def test_acceptance(val, validator): assert validator.validate_coerce(val) == val @@ -22,7 +22,7 @@ def test_acceptance(val, validator: SubplotidValidator): @pytest.mark.parametrize('val', [ 23, [], {}, set(), np.inf, np.nan ]) -def test_rejection_type(val, validator: SubplotidValidator): +def test_rejection_type(val, validator): with pytest.raises(ValueError) as validation_failure: validator.validate_coerce(val) @@ -35,7 +35,7 @@ def test_rejection_type(val, validator: SubplotidValidator): 'bogus', # Must begin with 'geo' 'geo0', # If followed by a number the number must be > 1 ]) -def test_rejection_value(val, validator: SubplotidValidator): +def test_rejection_value(val, validator): with pytest.raises(ValueError) as validation_failure: validator.validate_coerce(val) diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 4b2eef72833..00000000000 --- a/circle.yml +++ /dev/null @@ -1,74 +0,0 @@ -machine: - - environment: - - PLOTLY_CONFIG_DIR: ${HOME}/.plotly - TOX_TESTENV_PASSENV: PLOTLY_TOX_* - PLOTLY_TOX_PYTHON_27: /home/ubuntu/.pyenv/versions/2.7.10/bin/python2.7 - PLOTLY_TOX_PYTHON_33: /home/ubuntu/.pyenv/versions/3.3.3/bin/python3.3 - PLOTLY_TOX_PYTHON_34: /home/ubuntu/.pyenv/versions/3.4.3/bin/python3.4 - PLOTLY_TOX_PYTHON_35: /home/ubuntu/.pyenv/versions/3.5.0/bin/python3.5 - PLOTLY_JUPYTER_TEST_DIR: /home/ubuntu/${CIRCLE_PROJECT_REPONAME}/plotly/tests/test_optional/test_jupyter - - node: - # use a pre-installed version of node so we don't need to download it. - version: 6.0.0 - -dependencies: - - override: - - # install everything tox knows about and the plotly package. - - pip install tox - - tox --notest: - timeout: 1200 - - - pip install -I . - - # we need to cd out of the project root to ensure the install worked - - cd ~ && python -c "import plotly" - - # install jupyter test JS requirements - - cd ${PLOTLY_JUPYTER_TEST_DIR} && npm i: - timeout: 1200 - - cache_directories: - - # cache everything that tox installs for us. - - .tox - - ${PLOTLY_JUPYTER_TEST_DIR}/node_modules - -test: - - override: - - # let tox do its thing. matplotlib is broken at the moment. - - tox -- -a '!matplotlib' - - # we setup tox to create coverage reports, move them to artifacts. - - mv ~/${CIRCLE_PROJECT_REPONAME}/.tox/coverage-reports ${CIRCLE_ARTIFACTS} - - # import it once normally (ensures .plotly exists) - - python -c "import plotly" - - # test that it imports when you don't have write permissions - - sudo chmod -R 444 ${PLOTLY_CONFIG_DIR} && python -c "import plotly" - - # test that giving back write permissions works again - - sudo chmod -R 777 ${PLOTLY_CONFIG_DIR} && python -c "import plotly" - - # test that figure_factory cannot be imported with only core requirements. - # since optional requirements is part of the test suite, we don't need to - # worry about testing that it *can* be imported in this case. - - $(! python -c "import plotly.figure_factory") - - # test the distribution and a basic import - - rm -rf dist/ && - python setup.py sdist && - mkdir test_install && - cd test_install && - virtualenv venv && - source venv/bin/activate && - pip install ../dist/* && - python -c "import plotly;import plotly.graph_objs as go;go.Scatter()" - diff --git a/plotly/tests/test_plot_ly/__init__.py b/plotly/tests/test_plot_ly/__init__.py new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/plotly/tests/test_plot_ly/__init__.py @@ -0,0 +1 @@ + diff --git a/plotly/tests/test_core/test_api/__init__.py b/plotly/tests/test_plot_ly/test_api/__init__.py similarity index 100% rename from plotly/tests/test_core/test_api/__init__.py rename to plotly/tests/test_plot_ly/test_api/__init__.py diff --git a/plotly/tests/test_core/test_dashboard/__init__.py b/plotly/tests/test_plot_ly/test_api/test_v1/__init__.py similarity index 100% rename from plotly/tests/test_core/test_dashboard/__init__.py rename to plotly/tests/test_plot_ly/test_api/test_v1/__init__.py diff --git a/plotly/tests/test_core/test_api/test_v1/test_clientresp.py b/plotly/tests/test_plot_ly/test_api/test_v1/test_clientresp.py similarity index 97% rename from plotly/tests/test_core/test_api/test_v1/test_clientresp.py rename to plotly/tests/test_plot_ly/test_api/test_v1/test_clientresp.py index 18ee6435499..eba5e2f4294 100644 --- a/plotly/tests/test_core/test_api/test_v1/test_clientresp.py +++ b/plotly/tests/test_plot_ly/test_api/test_v1/test_clientresp.py @@ -2,7 +2,7 @@ from plotly import version from plotly.api.v1 import clientresp -from plotly.tests.test_core.test_api import PlotlyApiTestCase +from plotly.tests.test_plot_ly.test_api import PlotlyApiTestCase class Duck(object): diff --git a/plotly/tests/test_core/test_api/test_v1/test_utils.py b/plotly/tests/test_plot_ly/test_api/test_v1/test_utils.py similarity index 99% rename from plotly/tests/test_core/test_api/test_v1/test_utils.py rename to plotly/tests/test_plot_ly/test_api/test_v1/test_utils.py index 42ffcc613d1..ff2034c653f 100644 --- a/plotly/tests/test_core/test_api/test_v1/test_utils.py +++ b/plotly/tests/test_plot_ly/test_api/test_v1/test_utils.py @@ -10,7 +10,7 @@ from plotly.api.v1 import utils from plotly.exceptions import PlotlyError, PlotlyRequestError from plotly.session import sign_in -from plotly.tests.test_core.test_api import PlotlyApiTestCase +from plotly.tests.test_plot_ly.test_api import PlotlyApiTestCase from plotly.tests.utils import PlotlyTestCase import sys diff --git a/plotly/tests/test_core/test_file/__init__.py b/plotly/tests/test_plot_ly/test_api/test_v2/__init__.py similarity index 100% rename from plotly/tests/test_core/test_file/__init__.py rename to plotly/tests/test_plot_ly/test_api/test_v2/__init__.py diff --git a/plotly/tests/test_core/test_api/test_v2/test_files.py b/plotly/tests/test_plot_ly/test_api/test_v2/test_files.py similarity index 98% rename from plotly/tests/test_core/test_api/test_v2/test_files.py rename to plotly/tests/test_plot_ly/test_api/test_v2/test_files.py index 033c7e4655d..3ef68bf5cce 100644 --- a/plotly/tests/test_core/test_api/test_v2/test_files.py +++ b/plotly/tests/test_plot_ly/test_api/test_v2/test_files.py @@ -1,7 +1,7 @@ from __future__ import absolute_import from plotly.api.v2 import files -from plotly.tests.test_core.test_api import PlotlyApiTestCase +from plotly.tests.test_plot_ly.test_api import PlotlyApiTestCase class FilesTest(PlotlyApiTestCase): diff --git a/plotly/tests/test_core/test_api/test_v2/test_folders.py b/plotly/tests/test_plot_ly/test_api/test_v2/test_folders.py similarity index 98% rename from plotly/tests/test_core/test_api/test_v2/test_folders.py rename to plotly/tests/test_plot_ly/test_api/test_v2/test_folders.py index 871a9d17c3b..1775c57839a 100644 --- a/plotly/tests/test_core/test_api/test_v2/test_folders.py +++ b/plotly/tests/test_plot_ly/test_api/test_v2/test_folders.py @@ -1,7 +1,7 @@ from __future__ import absolute_import from plotly.api.v2 import folders -from plotly.tests.test_core.test_api import PlotlyApiTestCase +from plotly.tests.test_plot_ly.test_api import PlotlyApiTestCase class FoldersTest(PlotlyApiTestCase): diff --git a/plotly/tests/test_core/test_api/test_v2/test_grids.py b/plotly/tests/test_plot_ly/test_api/test_v2/test_grids.py similarity index 99% rename from plotly/tests/test_core/test_api/test_v2/test_grids.py rename to plotly/tests/test_plot_ly/test_api/test_v2/test_grids.py index 47ebb059fd2..4d373bbc676 100644 --- a/plotly/tests/test_core/test_api/test_v2/test_grids.py +++ b/plotly/tests/test_plot_ly/test_api/test_v2/test_grids.py @@ -3,7 +3,7 @@ from requests.compat import json as _json from plotly.api.v2 import grids -from plotly.tests.test_core.test_api import PlotlyApiTestCase +from plotly.tests.test_plot_ly.test_api import PlotlyApiTestCase class GridsTest(PlotlyApiTestCase): diff --git a/plotly/tests/test_core/test_api/test_v2/test_images.py b/plotly/tests/test_plot_ly/test_api/test_v2/test_images.py similarity index 95% rename from plotly/tests/test_core/test_api/test_v2/test_images.py rename to plotly/tests/test_plot_ly/test_api/test_v2/test_images.py index df330cc8d80..a392913fc68 100644 --- a/plotly/tests/test_core/test_api/test_v2/test_images.py +++ b/plotly/tests/test_plot_ly/test_api/test_v2/test_images.py @@ -3,7 +3,7 @@ from requests.compat import json as _json from plotly.api.v2 import images -from plotly.tests.test_core.test_api import PlotlyApiTestCase +from plotly.tests.test_plot_ly.test_api import PlotlyApiTestCase class ImagesTest(PlotlyApiTestCase): diff --git a/plotly/tests/test_core/test_api/test_v2/test_plot_schema.py b/plotly/tests/test_plot_ly/test_api/test_v2/test_plot_schema.py similarity index 93% rename from plotly/tests/test_core/test_api/test_v2/test_plot_schema.py rename to plotly/tests/test_plot_ly/test_api/test_v2/test_plot_schema.py index edc7d2a5117..77b5d805ecd 100644 --- a/plotly/tests/test_core/test_api/test_v2/test_plot_schema.py +++ b/plotly/tests/test_plot_ly/test_api/test_v2/test_plot_schema.py @@ -1,7 +1,7 @@ from __future__ import absolute_import from plotly.api.v2 import plot_schema -from plotly.tests.test_core.test_api import PlotlyApiTestCase +from plotly.tests.test_plot_ly.test_api import PlotlyApiTestCase class PlotSchemaTest(PlotlyApiTestCase): diff --git a/plotly/tests/test_core/test_api/test_v2/test_plots.py b/plotly/tests/test_plot_ly/test_api/test_v2/test_plots.py similarity index 98% rename from plotly/tests/test_core/test_api/test_v2/test_plots.py rename to plotly/tests/test_plot_ly/test_api/test_v2/test_plots.py index f43fbca223d..17f243ae8e1 100644 --- a/plotly/tests/test_core/test_api/test_v2/test_plots.py +++ b/plotly/tests/test_plot_ly/test_api/test_v2/test_plots.py @@ -1,7 +1,7 @@ from __future__ import absolute_import from plotly.api.v2 import plots -from plotly.tests.test_core.test_api import PlotlyApiTestCase +from plotly.tests.test_plot_ly.test_api import PlotlyApiTestCase class PlotsTest(PlotlyApiTestCase): diff --git a/plotly/tests/test_core/test_api/test_v2/test_users.py b/plotly/tests/test_plot_ly/test_api/test_v2/test_users.py similarity index 93% rename from plotly/tests/test_core/test_api/test_v2/test_users.py rename to plotly/tests/test_plot_ly/test_api/test_v2/test_users.py index 2c192b6bc4a..b5a69212d22 100644 --- a/plotly/tests/test_core/test_api/test_v2/test_users.py +++ b/plotly/tests/test_plot_ly/test_api/test_v2/test_users.py @@ -1,7 +1,7 @@ from __future__ import absolute_import from plotly.api.v2 import users -from plotly.tests.test_core.test_api import PlotlyApiTestCase +from plotly.tests.test_plot_ly.test_api import PlotlyApiTestCase class UsersTest(PlotlyApiTestCase): diff --git a/plotly/tests/test_core/test_api/test_v2/test_utils.py b/plotly/tests/test_plot_ly/test_api/test_v2/test_utils.py similarity index 99% rename from plotly/tests/test_core/test_api/test_v2/test_utils.py rename to plotly/tests/test_plot_ly/test_api/test_v2/test_utils.py index 0b1b83400e7..cef3e1d2e9a 100644 --- a/plotly/tests/test_core/test_api/test_v2/test_utils.py +++ b/plotly/tests/test_plot_ly/test_api/test_v2/test_utils.py @@ -8,7 +8,7 @@ from plotly.api.v2 import utils from plotly.exceptions import PlotlyRequestError from plotly.session import sign_in -from plotly.tests.test_core.test_api import PlotlyApiTestCase +from plotly.tests.test_plot_ly.test_api import PlotlyApiTestCase class MakeParamsTest(PlotlyApiTestCase): diff --git a/plotly/tests/test_core/test_get_requests/__init__.py b/plotly/tests/test_plot_ly/test_dashboard/__init__.py similarity index 100% rename from plotly/tests/test_core/test_get_requests/__init__.py rename to plotly/tests/test_plot_ly/test_dashboard/__init__.py diff --git a/plotly/tests/test_core/test_dashboard/test_dashboard.py b/plotly/tests/test_plot_ly/test_dashboard/test_dashboard.py similarity index 100% rename from plotly/tests/test_core/test_dashboard/test_dashboard.py rename to plotly/tests/test_plot_ly/test_dashboard/test_dashboard.py diff --git a/plotly/tests/test_core/test_grid/__init__.py b/plotly/tests/test_plot_ly/test_file/__init__.py similarity index 100% rename from plotly/tests/test_core/test_grid/__init__.py rename to plotly/tests/test_plot_ly/test_file/__init__.py diff --git a/plotly/tests/test_core/test_file/test_file.py b/plotly/tests/test_plot_ly/test_file/test_file.py similarity index 100% rename from plotly/tests/test_core/test_file/test_file.py rename to plotly/tests/test_plot_ly/test_file/test_file.py diff --git a/plotly/tests/test_core/test_get_figure/__init__.py b/plotly/tests/test_plot_ly/test_get_figure/__init__.py similarity index 100% rename from plotly/tests/test_core/test_get_figure/__init__.py rename to plotly/tests/test_plot_ly/test_get_figure/__init__.py diff --git a/plotly/tests/test_core/test_get_figure/test_get_figure.py b/plotly/tests/test_plot_ly/test_get_figure/test_get_figure.py similarity index 100% rename from plotly/tests/test_core/test_get_figure/test_get_figure.py rename to plotly/tests/test_plot_ly/test_get_figure/test_get_figure.py diff --git a/plotly/tests/test_core/test_image/__init__.py b/plotly/tests/test_plot_ly/test_get_requests/__init__.py similarity index 100% rename from plotly/tests/test_core/test_image/__init__.py rename to plotly/tests/test_plot_ly/test_get_requests/__init__.py diff --git a/plotly/tests/test_core/test_get_requests/test_get_requests.py b/plotly/tests/test_plot_ly/test_get_requests/test_get_requests.py similarity index 100% rename from plotly/tests/test_core/test_get_requests/test_get_requests.py rename to plotly/tests/test_plot_ly/test_get_requests/test_get_requests.py diff --git a/plotly/tests/test_core/test_meta/__init__.py b/plotly/tests/test_plot_ly/test_grid/__init__.py similarity index 100% rename from plotly/tests/test_core/test_meta/__init__.py rename to plotly/tests/test_plot_ly/test_grid/__init__.py diff --git a/plotly/tests/test_core/test_grid/test_grid.py b/plotly/tests/test_plot_ly/test_grid/test_grid.py similarity index 100% rename from plotly/tests/test_core/test_grid/test_grid.py rename to plotly/tests/test_plot_ly/test_grid/test_grid.py diff --git a/plotly/tests/test_core/test_session/__init__.py b/plotly/tests/test_plot_ly/test_image/__init__.py similarity index 100% rename from plotly/tests/test_core/test_session/__init__.py rename to plotly/tests/test_plot_ly/test_image/__init__.py diff --git a/plotly/tests/test_core/test_image/test_image.py b/plotly/tests/test_plot_ly/test_image/test_image.py similarity index 100% rename from plotly/tests/test_core/test_image/test_image.py rename to plotly/tests/test_plot_ly/test_image/test_image.py diff --git a/plotly/tests/test_core/test_spectacle_presentation/__init__.py b/plotly/tests/test_plot_ly/test_meta/__init__.py similarity index 100% rename from plotly/tests/test_core/test_spectacle_presentation/__init__.py rename to plotly/tests/test_plot_ly/test_meta/__init__.py diff --git a/plotly/tests/test_core/test_meta/test_meta.py b/plotly/tests/test_plot_ly/test_meta/test_meta.py similarity index 100% rename from plotly/tests/test_core/test_meta/test_meta.py rename to plotly/tests/test_plot_ly/test_meta/test_meta.py diff --git a/plotly/tests/test_core/test_plotly/__init__.py b/plotly/tests/test_plot_ly/test_plotly/__init__.py similarity index 100% rename from plotly/tests/test_core/test_plotly/__init__.py rename to plotly/tests/test_plot_ly/test_plotly/__init__.py diff --git a/plotly/tests/test_core/test_plotly/test_credentials.py b/plotly/tests/test_plot_ly/test_plotly/test_credentials.py similarity index 100% rename from plotly/tests/test_core/test_plotly/test_credentials.py rename to plotly/tests/test_plot_ly/test_plotly/test_credentials.py diff --git a/plotly/tests/test_core/test_plotly/test_plot.py b/plotly/tests/test_plot_ly/test_plotly/test_plot.py similarity index 100% rename from plotly/tests/test_core/test_plotly/test_plot.py rename to plotly/tests/test_plot_ly/test_plotly/test_plot.py diff --git a/plotly/tests/test_core/test_stream/__init__.py b/plotly/tests/test_plot_ly/test_session/__init__.py similarity index 100% rename from plotly/tests/test_core/test_stream/__init__.py rename to plotly/tests/test_plot_ly/test_session/__init__.py diff --git a/plotly/tests/test_core/test_session/test_session.py b/plotly/tests/test_plot_ly/test_session/test_session.py similarity index 100% rename from plotly/tests/test_core/test_session/test_session.py rename to plotly/tests/test_plot_ly/test_session/test_session.py diff --git a/plotly/tests/test_plot_ly/test_spectacle_presentation/__init__.py b/plotly/tests/test_plot_ly/test_spectacle_presentation/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/plotly/tests/test_core/test_spectacle_presentation/test_spectacle_presentation.py b/plotly/tests/test_plot_ly/test_spectacle_presentation/test_spectacle_presentation.py similarity index 100% rename from plotly/tests/test_core/test_spectacle_presentation/test_spectacle_presentation.py rename to plotly/tests/test_plot_ly/test_spectacle_presentation/test_spectacle_presentation.py diff --git a/plotly/tests/test_plot_ly/test_stream/__init__.py b/plotly/tests/test_plot_ly/test_stream/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/plotly/tests/test_core/test_stream/test_stream.py b/plotly/tests/test_plot_ly/test_stream/test_stream.py similarity index 100% rename from plotly/tests/test_core/test_stream/test_stream.py rename to plotly/tests/test_plot_ly/test_stream/test_stream.py diff --git a/tox.ini b/tox.ini index 57609e8989e..a913d3c6ce4 100644 --- a/tox.ini +++ b/tox.ini @@ -37,7 +37,7 @@ [tox] ; The py{A,B,C}-{X,Y} generates a matrix of envs: ; pyA-X,pyA-Y,pyB-X,pyB-Y,pyC-X,pyC-Y -envlist = py{27,34,35}-{core,optional},py33-core +envlist = py{27,34,35,36,37}-{core,optional},py{27,34,37}-plot_ly ; Note that envs can be targeted by deps using the : dep syntax. ; Only one dep is allowed per line as of the time of writing. The @@ -58,14 +58,16 @@ deps= six==1.10.0 pytz==2016.10 retrying==1.3.3 + pytest==3.5.1 optional: numpy==1.11.3 optional: ipython[all]==5.1.0 optional: jupyter==1.0.0 optional: pandas==0.19.2 optional: scipy==0.18.1 - optional: shapely==1.6.3 + optional: shapely==1.6.4 optional: geopandas==0.3.0 optional: pyshp==1.2.10 + optional: pillow==5.2.0 ; CORE ENVIRONMENTS [testenv:py27-core] @@ -74,12 +76,6 @@ commands= python --version nosetests {posargs} -x plotly/tests/test_core -[testenv:py33-core] -basepython={env:PLOTLY_TOX_PYTHON_33:} -commands= - python --version - nosetests {posargs} -x plotly/tests/test_core - [testenv:py34-core] basepython={env:PLOTLY_TOX_PYTHON_34:} commands= @@ -98,31 +94,78 @@ commands= python --version nosetests {posargs} -x plotly/tests/test_core +[testenv:py37-core] +basepython={env:PLOTLY_TOX_PYTHON_37:} +commands= + python --version + nosetests {posargs} -x plotly/tests/test_core + ; OPTIONAL ENVIRONMENTS +;[testenv:py27-optional] +;basepython={env:PLOTLY_TOX_PYTHON_27:} +;commands= +; python --version +;; Do some coverage reporting. No need to do this for all environments. +; mkdir -p {envbindir}/../../coverage-reports/{envname} +; coverage erase +; coverage run --include="*/plotly/*" --omit="*/tests*" {envbindir}/nosetests {posargs} -x plotly/tests +; coverage html -d "{envbindir}/../../coverage-reports/{envname}" --title={envname} + [testenv:py27-optional] basepython={env:PLOTLY_TOX_PYTHON_27:} commands= python --version -; Do some coverage reporting. No need to do this for all environments. - mkdir -p {envbindir}/../../coverage-reports/{envname} - coverage erase - coverage run --include="*/plotly/*" --omit="*/tests*" {envbindir}/nosetests {posargs} -x plotly/tests - coverage html -d "{envbindir}/../../coverage-reports/{envname}" --title={envname} + nosetests {posargs} -x plotly/tests/test_core + nosetests {posargs} -x plotly/tests/test_optional + pytest _plotly_utils/tests/ [testenv:py34-optional] basepython={env:PLOTLY_TOX_PYTHON_34:} commands= python --version - nosetests {posargs} -x plotly/tests + nosetests {posargs} -x plotly/tests/test_core + nosetests {posargs} -x plotly/tests/test_optional + pytest _plotly_utils/tests/ [testenv:py35-optional] basepython={env:PLOTLY_TOX_PYTHON_35:} commands= python --version - nosetests {posargs} -x plotly/tests + nosetests {posargs} -x plotly/tests/test_core + nosetests {posargs} -x plotly/tests/test_optional + pytest _plotly_utils/tests/ [testenv:py36-optional] basepython={env:PLOTLY_TOX_PYTHON_36:} commands= python --version - nosetests {posargs} -x plotly/tests + nosetests {posargs} -x plotly/tests/test_core + nosetests {posargs} -x plotly/tests/test_optional + pytest _plotly_utils/tests/ + +[testenv:py37-optional] +basepython={env:PLOTLY_TOX_PYTHON_37:} +commands= + python --version + nosetests {posargs} -x plotly/tests/test_core + nosetests {posargs} -x plotly/tests/test_optional + pytest _plotly_utils/tests/ + +; Plot.ly environments +[testenv:py27-plot_ly] +basepython={env:PLOTLY_TOX_PYTHON_27:} +commands= + python --version + nosetests {posargs} -x plotly/tests/test_plot_ly + +[testenv:py34-plot_ly] +basepython={env:PLOTLY_TOX_PYTHON_34:} +commands= + python --version + nosetests {posargs} -x plotly/tests/test_plot_ly + +[testenv:py37-plot_ly] +basepython={env:PLOTLY_TOX_PYTHON_37:} +commands= + python --version + nosetests {posargs} -x plotly/tests/test_plot_ly \ No newline at end of file