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

chore: remove old py versions #373

Merged
merged 18 commits into from
Jan 12, 2022
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
37 changes: 17 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
language: python
dist: focal
language: python
python:
- "2.7"
# - "3.4"
- "3.5.5"
- "3.6"
# - "3.7" is handled in 'Test' job using xenial as Python 3.7 is not available for trusty.
# - "3.8" is handled in 'Test' job using xenial as Python 3.8 is not available for trusty.
# - "pypy"
# - "pypy3"
- "pypy3.7-7.3.5"
- "3.7"
- "3.8"
- "3.9"
- "3.10.0"
before_install: "python -m pip install --upgrade pip"
install: "pip install -r requirements/core.txt;pip install -r requirements/test.txt"
script: "pytest --cov=optimizely"
after_success:
Expand Down Expand Up @@ -35,10 +34,10 @@ jobs:

- stage: 'Linting'
language: python
python: "2.7"
python: "3.9"
# flake8 version should be same as the version in requirements/test.txt
# to avoid lint errors on CI
install: "pip install flake8==3.6.0"
install: "pip install flake8>=4.1.0"
script: "flake8"
after_success: travis_terminate 0

Expand All @@ -62,19 +61,17 @@ jobs:
SDK_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH
FULLSTACK_TEST_REPO=ProdTesting
- stage: 'Test'
python: "pypy"
before_install:
- pip install "cryptography>=1.3.4,<=3.1.1" # installing in before_install doesn't re-install the latest version of the same package in the next stage.
python: "pypy3.7-7.3.5"
# before_install:
# - pip install "cryptography>=1.3.4"
- stage: 'Test'
python: "pypy3"
before_install:
- pip install "cryptography>=1.3.4,<=3.1.1"
- stage: 'Test'
dist: xenial
python: "3.7"
- stage: 'Test'
dist: xenial
python: "3.8"
- stage: 'Test'
python: "3.9"
- stage: 'Test'
python: "3.10.0"

- stage: 'Source Clear'
if: type = cron
Expand Down
4 changes: 2 additions & 2 deletions requirements/core.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
jsonschema==3.2.0
pyrsistent==0.16.0
jsonschema>=3.2.0
pyrsistent>=0.16.0
requests>=2.21
pyOpenSSL>=19.1.0
cryptography>=2.8.0
Expand Down
8 changes: 4 additions & 4 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
coverage
flake8==3.6.0
funcsigs==0.4
mock==1.3.0
pytest>=4.6.0
flake8 >= 4.0.1
funcsigs >= 0.4
mock >= 4.0.0
pytest >= 6.2.0
pytest-cov
python-coveralls
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
'Optimizely X Full Stack is A/B testing and feature management for product development teams. '
'Experiment in any application. Make every feature on your roadmap an opportunity to learn. '
'Learn more at https://www.optimizely.com/products/full-stack/ or see our documentation at '
'https://docs.developers.optimizely.com/full-stack/docs.'
'https://docs.developers.optimizely.com/full-stack/docs. '
)

setup(
Expand Down
133 changes: 0 additions & 133 deletions tests/helpers_tests/test_condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import json
import mock
from six import PY2

from optimizely.helpers import condition as condition_helper

Expand Down Expand Up @@ -394,13 +393,6 @@ def test_exact_string__returns_null__when_no_user_provided_value(self):

def test_exact_int__returns_true__when_user_provided_value_is_equal_to_condition_value(self, ):

if PY2:
evaluator = condition_helper.CustomAttributeConditionEvaluator(
exact_int_condition_list, {'lasers_count': long(9000)}, self.mock_client_logger,
)

self.assertStrictTrue(evaluator.evaluate(0))

evaluator = condition_helper.CustomAttributeConditionEvaluator(
exact_int_condition_list, {'lasers_count': 9000}, self.mock_client_logger
)
Expand All @@ -415,13 +407,6 @@ def test_exact_int__returns_true__when_user_provided_value_is_equal_to_condition

def test_exact_float__returns_true__when_user_provided_value_is_equal_to_condition_value(self, ):

if PY2:
evaluator = condition_helper.CustomAttributeConditionEvaluator(
exact_float_condition_list, {'lasers_count': long(9000)}, self.mock_client_logger,
)

self.assertStrictTrue(evaluator.evaluate(0))

evaluator = condition_helper.CustomAttributeConditionEvaluator(
exact_float_condition_list, {'lasers_count': 9000}, self.mock_client_logger
)
Expand Down Expand Up @@ -599,13 +584,6 @@ def test_greater_than_int__returns_true__when_user_value_greater_than_condition_

self.assertStrictTrue(evaluator.evaluate(0))

if PY2:
evaluator = condition_helper.CustomAttributeConditionEvaluator(
gt_int_condition_list, {'meters_travelled': long(49)}, self.mock_client_logger,
)

self.assertStrictTrue(evaluator.evaluate(0))

def test_greater_than_float__returns_true__when_user_value_greater_than_condition_value(self, ):

evaluator = condition_helper.CustomAttributeConditionEvaluator(
Expand All @@ -620,13 +598,6 @@ def test_greater_than_float__returns_true__when_user_value_greater_than_conditio

self.assertStrictTrue(evaluator.evaluate(0))

if PY2:
evaluator = condition_helper.CustomAttributeConditionEvaluator(
gt_float_condition_list, {'meters_travelled': long(49)}, self.mock_client_logger,
)

self.assertStrictTrue(evaluator.evaluate(0))

def test_greater_than_int__returns_false__when_user_value_not_greater_than_condition_value(self, ):

evaluator = condition_helper.CustomAttributeConditionEvaluator(
Expand All @@ -641,13 +612,6 @@ def test_greater_than_int__returns_false__when_user_value_not_greater_than_condi

self.assertStrictFalse(evaluator.evaluate(0))

if PY2:
evaluator = condition_helper.CustomAttributeConditionEvaluator(
gt_int_condition_list, {'meters_travelled': long(47)}, self.mock_client_logger,
)

self.assertStrictFalse(evaluator.evaluate(0))

def test_greater_than_float__returns_false__when_user_value_not_greater_than_condition_value(self, ):

evaluator = condition_helper.CustomAttributeConditionEvaluator(
Expand All @@ -662,13 +626,6 @@ def test_greater_than_float__returns_false__when_user_value_not_greater_than_con

self.assertStrictFalse(evaluator.evaluate(0))

if PY2:
evaluator = condition_helper.CustomAttributeConditionEvaluator(
gt_float_condition_list, {'meters_travelled': long(48)}, self.mock_client_logger,
)

self.assertStrictFalse(evaluator.evaluate(0))

def test_greater_than_int__returns_null__when_user_value_is_not_a_number(self):

evaluator = condition_helper.CustomAttributeConditionEvaluator(
Expand Down Expand Up @@ -733,13 +690,6 @@ def test_greater_than_or_equal_int__returns_true__when_user_value_greater_than_o

self.assertStrictTrue(evaluator.evaluate(0))

if PY2:
evaluator = condition_helper.CustomAttributeConditionEvaluator(
gt_int_condition_list, {'meters_travelled': long(49)}, self.mock_client_logger,
)

self.assertStrictTrue(evaluator.evaluate(0))

def test_greater_than_or_equal_float__returns_true__when_user_value_greater_than_or_equal_condition_value(self):

evaluator = condition_helper.CustomAttributeConditionEvaluator(
Expand All @@ -760,13 +710,6 @@ def test_greater_than_or_equal_float__returns_true__when_user_value_greater_than

self.assertStrictTrue(evaluator.evaluate(0))

if PY2:
evaluator = condition_helper.CustomAttributeConditionEvaluator(
ge_float_condition_list, {'meters_travelled': long(49)}, self.mock_client_logger,
)

self.assertStrictTrue(evaluator.evaluate(0))

def test_greater_than_or_equal_int__returns_false__when_user_value_not_greater_than_or_equal_condition_value(
self):

Expand All @@ -782,13 +725,6 @@ def test_greater_than_or_equal_int__returns_false__when_user_value_not_greater_t

self.assertStrictFalse(evaluator.evaluate(0))

if PY2:
evaluator = condition_helper.CustomAttributeConditionEvaluator(
ge_int_condition_list, {'meters_travelled': long(47)}, self.mock_client_logger,
)

self.assertStrictFalse(evaluator.evaluate(0))

def test_greater_than_or_equal_float__returns_false__when_user_value_not_greater_than_or_equal_condition_value(
self):

Expand All @@ -804,13 +740,6 @@ def test_greater_than_or_equal_float__returns_false__when_user_value_not_greater

self.assertStrictFalse(evaluator.evaluate(0))

if PY2:
evaluator = condition_helper.CustomAttributeConditionEvaluator(
ge_float_condition_list, {'meters_travelled': long(48)}, self.mock_client_logger,
)

self.assertStrictFalse(evaluator.evaluate(0))

def test_greater_than_or_equal_int__returns_null__when_user_value_is_not_a_number(self):

evaluator = condition_helper.CustomAttributeConditionEvaluator(
Expand Down Expand Up @@ -869,13 +798,6 @@ def test_less_than_int__returns_true__when_user_value_less_than_condition_value(

self.assertStrictTrue(evaluator.evaluate(0))

if PY2:
evaluator = condition_helper.CustomAttributeConditionEvaluator(
lt_int_condition_list, {'meters_travelled': long(47)}, self.mock_client_logger,
)

self.assertStrictTrue(evaluator.evaluate(0))

def test_less_than_float__returns_true__when_user_value_less_than_condition_value(self, ):

evaluator = condition_helper.CustomAttributeConditionEvaluator(
Expand All @@ -890,13 +812,6 @@ def test_less_than_float__returns_true__when_user_value_less_than_condition_valu

self.assertStrictTrue(evaluator.evaluate(0))

if PY2:
evaluator = condition_helper.CustomAttributeConditionEvaluator(
lt_float_condition_list, {'meters_travelled': long(48)}, self.mock_client_logger,
)

self.assertStrictTrue(evaluator.evaluate(0))

def test_less_than_int__returns_false__when_user_value_not_less_than_condition_value(self, ):

evaluator = condition_helper.CustomAttributeConditionEvaluator(
Expand All @@ -911,13 +826,6 @@ def test_less_than_int__returns_false__when_user_value_not_less_than_condition_v

self.assertStrictFalse(evaluator.evaluate(0))

if PY2:
evaluator = condition_helper.CustomAttributeConditionEvaluator(
lt_int_condition_list, {'meters_travelled': long(49)}, self.mock_client_logger,
)

self.assertStrictFalse(evaluator.evaluate(0))

def test_less_than_float__returns_false__when_user_value_not_less_than_condition_value(self, ):

evaluator = condition_helper.CustomAttributeConditionEvaluator(
Expand All @@ -932,13 +840,6 @@ def test_less_than_float__returns_false__when_user_value_not_less_than_condition

self.assertStrictFalse(evaluator.evaluate(0))

if PY2:
evaluator = condition_helper.CustomAttributeConditionEvaluator(
lt_float_condition_list, {'meters_travelled': long(49)}, self.mock_client_logger,
)

self.assertStrictFalse(evaluator.evaluate(0))

def test_less_than_int__returns_null__when_user_value_is_not_a_number(self):

evaluator = condition_helper.CustomAttributeConditionEvaluator(
Expand Down Expand Up @@ -991,19 +892,6 @@ def test_less_than_or_equal_int__returns_true__when_user_value_less_than_or_equa

self.assertStrictTrue(evaluator.evaluate(0))

if PY2:
evaluator = condition_helper.CustomAttributeConditionEvaluator(
le_int_condition_list, {'meters_travelled': long(47)}, self.mock_client_logger,
)

self.assertStrictTrue(evaluator.evaluate(0))

evaluator = condition_helper.CustomAttributeConditionEvaluator(
le_int_condition_list, {'meters_travelled': long(48)}, self.mock_client_logger,
)

self.assertStrictTrue(evaluator.evaluate(0))

def test_less_than_or_equal_float__returns_true__when_user_value_less_than_or_equal_condition_value(self):

evaluator = condition_helper.CustomAttributeConditionEvaluator(
Expand All @@ -1024,13 +912,6 @@ def test_less_than_or_equal_float__returns_true__when_user_value_less_than_or_eq

self.assertStrictTrue(evaluator.evaluate(0))

if PY2:
evaluator = condition_helper.CustomAttributeConditionEvaluator(
le_float_condition_list, {'meters_travelled': long(48)}, self.mock_client_logger,
)

self.assertStrictTrue(evaluator.evaluate(0))

def test_less_than_or_equal_int__returns_false__when_user_value_not_less_than_or_equal_condition_value(self):

evaluator = condition_helper.CustomAttributeConditionEvaluator(
Expand All @@ -1045,13 +926,6 @@ def test_less_than_or_equal_int__returns_false__when_user_value_not_less_than_or

self.assertStrictFalse(evaluator.evaluate(0))

if PY2:
evaluator = condition_helper.CustomAttributeConditionEvaluator(
le_int_condition_list, {'meters_travelled': long(49)}, self.mock_client_logger,
)

self.assertStrictFalse(evaluator.evaluate(0))

def test_less_than_or_equal_float__returns_false__when_user_value_not_less_than_or_equal_condition_value(self):

evaluator = condition_helper.CustomAttributeConditionEvaluator(
Expand All @@ -1066,13 +940,6 @@ def test_less_than_or_equal_float__returns_false__when_user_value_not_less_than_

self.assertStrictFalse(evaluator.evaluate(0))

if PY2:
evaluator = condition_helper.CustomAttributeConditionEvaluator(
le_float_condition_list, {'meters_travelled': long(49)}, self.mock_client_logger,
)

self.assertStrictFalse(evaluator.evaluate(0))

def test_less_than_or_equal_int__returns_null__when_user_value_is_not_a_number(self):

evaluator = condition_helper.CustomAttributeConditionEvaluator(
Expand Down
13 changes: 0 additions & 13 deletions tests/helpers_tests/test_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
import json
import mock

from six import PY2

from optimizely import config_manager
from optimizely import error_handler
from optimizely import event_dispatcher
Expand Down Expand Up @@ -230,12 +228,6 @@ def test_is_attribute_valid(self):

mock_is_finite.assert_called_once_with(5.5)

if PY2:
with mock.patch('optimizely.helpers.validator.is_finite_number', return_value=None) as mock_is_finite:
self.assertIsNone(validator.is_attribute_valid('test_attribute', long(5)))

mock_is_finite.assert_called_once_with(long(5))

def test_is_finite_number(self):
""" Test that it returns true if value is a number and not NAN, INF, -INF or greater than 2^53.
Otherwise False.
Expand All @@ -257,9 +249,6 @@ def test_is_finite_number(self):
self.assertFalse(validator.is_finite_number(-int(2 ** 53) - 1))
self.assertFalse(validator.is_finite_number(float(2 ** 53) + 2.0))
self.assertFalse(validator.is_finite_number(-float(2 ** 53) - 2.0))
if PY2:
self.assertFalse(validator.is_finite_number(long(2 ** 53) + 1))
self.assertFalse(validator.is_finite_number(-long(2 ** 53) - 1))

# test valid numbers
self.assertTrue(validator.is_finite_number(0))
Expand All @@ -269,8 +258,6 @@ def test_is_finite_number(self):
self.assertTrue(validator.is_finite_number(float(2 ** 53) + 1.0))
self.assertTrue(validator.is_finite_number(-float(2 ** 53) - 1.0))
self.assertTrue(validator.is_finite_number(int(2 ** 53)))
if PY2:
self.assertTrue(validator.is_finite_number(long(2 ** 53)))


class DatafileValidationTests(base.BaseTest):
Expand Down
Loading