Skip to content

Commit

Permalink
Drop Python 2.7 (#1175)
Browse files Browse the repository at this point in the history
  • Loading branch information
msyyc authored Mar 2, 2022
1 parent c87b121 commit be8ef9b
Show file tree
Hide file tree
Showing 55 changed files with 91 additions and 310 deletions.
6 changes: 5 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Change Log

### 2022-xx-xx - 5.12.7
### 2022-03-02 - 5.13.0

| Library | Min Version
| --------------- | -------
Expand All @@ -15,6 +15,10 @@
- Add default value consistently for parameters #1164
- Make `content_type` param keyword-only if there are multiple content types #1167

**Other Changes**

- Drop testing support for 2.7 packages #1175

### 2022-02-09 - 5.12.6

| Library | Min Version
Expand Down
26 changes: 11 additions & 15 deletions eng/pipelines/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ jobs:

strategy:
matrix:
Linux_Python27:
OSName: "Linux"
OSVmImage: "MMSUbuntu20.04"
PythonVersion: "2.7"
Linux_Python37:
OSName: "Linux"
OSVmImage: "MMSUbuntu20.04"
Expand Down Expand Up @@ -102,9 +98,9 @@ jobs:
cd $(TestFolder)/azure/low-level
tox -e ci
displayName: 'Execute low-level "azure" Tests - Python $(PythonVersion)'
condition: and(succeededOrFailed(), ne(variables['PythonVersion'], '2.7'))
condition: succeededOrFailed()
- task: PublishTestResults@2
condition: and(succeededOrFailed(), ne(variables['PythonVersion'], '2.7'))
condition: succeededOrFailed()
displayName: 'Publish low-level "azure" Test Results'
inputs:
testRunTitle: "$(OSName) Python $(PythonVersion) - low-level azure"
Expand All @@ -114,9 +110,9 @@ jobs:
cd $(TestFolder)/azure/version-tolerant
tox -e ci
displayName: 'Execute version-tolerant "azure" Tests - Python $(PythonVersion)'
condition: and(succeededOrFailed(), ne(variables['PythonVersion'], '2.7'))
condition: succeededOrFailed()
- task: PublishTestResults@2
condition: and(succeededOrFailed(), ne(variables['PythonVersion'], '2.7'))
condition: succeededOrFailed()
displayName: 'Publish version-tolerant "azure" Test Results'
inputs:
testRunTitle: "$(OSName) Python $(PythonVersion) - version-tolerant azure"
Expand All @@ -143,10 +139,10 @@ jobs:
cd $(TestFolder)/vanilla/low-level
tox -e ci
displayName: 'Execute low level "vanilla" Tests - Python $(PythonVersion)'
condition: and(succeededOrFailed(), ne(variables['PythonVersion'], '2.7'))
condition: succeededOrFailed()
- task: PublishTestResults@2
displayName: 'Publish low level "vanilla" Test Results'
condition: and(succeededOrFailed(), ne(variables['PythonVersion'], '2.7'))
condition: succeededOrFailed()
inputs:
testRunTitle: "$(OSName) Python $(PythonVersion) - low level vanilla"
searchFolder: "$(TestFolder)/vanilla/low-level"
Expand All @@ -155,10 +151,10 @@ jobs:
cd $(TestFolder)/vanilla/version-tolerant
tox -e ci
displayName: 'Execute version-tolerant "vanilla" Tests - Python $(PythonVersion)'
condition: and(succeededOrFailed(), ne(variables['PythonVersion'], '2.7'))
condition: succeededOrFailed()
- task: PublishTestResults@2
displayName: 'Publish version-tolerant "vanilla" Test Results'
condition: and(succeededOrFailed(), ne(variables['PythonVersion'], '2.7'))
condition: succeededOrFailed()
inputs:
testRunTitle: "$(OSName) Python $(PythonVersion) - version-tolerant vanilla"
searchFolder: "$(TestFolder)/vanilla/version-tolerant"
Expand All @@ -173,12 +169,12 @@ jobs:
cd $(TestFolder)/dpg/low-level
tox -e ci
displayName: 'Execute low level update "dpg" Tests - Python $(PythonVersion)'
condition: and(succeededOrFailed(), ne(variables['PythonVersion'], '2.7'))
condition: succeededOrFailed()
- script: |
cd $(TestFolder)/dpg/version-tolerant
tox -e ci
displayName: 'Execute version-tolerant update "dpg" Tests - Python $(PythonVersion)'
condition: and(succeededOrFailed(), ne(variables['PythonVersion'], '2.7'))
condition: succeededOrFailed()
- script: |
cd $(TestFolder)/dpg/version-tolerant
tox -e lint
Expand Down Expand Up @@ -208,7 +204,7 @@ jobs:
displayName: "Publish coverage report to storage account"
condition: and(succeededOrFailed(), eq(variables['PythonVersion'], '3.10'))
- ${{ if eq(and(ne(variables['Build.Reason'], 'PullRequest'), ne(variables['PythonVersion'], '2.7')), 'True') }}:
- ${{ if eq(ne(variables['Build.Reason'], 'PullRequest'), 'True') }}:
- script: |
git clone https://github.com/Azure/azure-sdk-for-python.git --depth=1 --branch main $(Build.SourcesDirectory)/regenerated/
displayName: 'Clone python repo'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@autorest/python",
"version": "5.12.6",
"version": "5.13.0",
"description": "The Python extension for generators in AutoRest.",
"scripts": {
"prepare": "node run-python3.js prepare.py",
Expand Down
6 changes: 0 additions & 6 deletions test/azure/legacy/AcceptanceTests/asynctests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,3 @@
# IN THE SOFTWARE.
#
# --------------------------------------------------------------------------

import sys
import pytest

pytestmark = pytest.mark.skipif(sys.version_info < (3,6),
reason="requires python3.6")
5 changes: 0 additions & 5 deletions test/azure/legacy/AcceptanceTests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ def testserver():
yield
terminate_server_process(server)

# Ignore collection of async tests for Python 2
collect_ignore = []
if sys.version_info < (3,5):
collect_ignore.append("asynctests")


class CookiePolicy(SansIOHTTPPolicy):
def __init__(self, *args, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,8 @@ def test_custom_base_uri_bad_host(self, client):
def test_models(self):
from custombaseurl.models import Error

if sys.version_info >= (3,5):
from custombaseurl.models._models_py3 import Error as ErrorPy3
assert Error == ErrorPy3
else:
from custombaseurl.models._models import Error as ErrorPy2
assert Error == ErrorPy2
from custombaseurl.models._models_py3 import Error as ErrorPy3
assert Error == ErrorPy3

def test_operation_groups(self):
from custombaseurl.operations import PathsOperations
Expand Down
8 changes: 2 additions & 6 deletions test/azure/legacy/AcceptanceTests/test_azure_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,8 @@ def test_azure_url(self, credential, authentication_policy):
def test_models(self):
from subscriptionidapiversion.models import Error

if sys.version_info >= (3,5):
from subscriptionidapiversion.models._models_py3 import Error as ErrorPy3
assert Error == ErrorPy3
else:
from subscriptionidapiversion.models._models import Error as ErrorPy2
assert Error == ErrorPy2
from subscriptionidapiversion.models._models_py3 import Error as ErrorPy3
assert Error == ErrorPy3

def test_operation_groups(self):
from subscriptionidapiversion.operations import GroupOperations
Expand Down
9 changes: 2 additions & 7 deletions test/azure/legacy/AcceptanceTests/test_duration.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,8 @@ def test_positive_duration(self, client):

def test_models(self):
from bodyduration.models import Error

if sys.version_info >= (3,5):
from bodyduration.models._models_py3 import Error as ErrorPy3
assert Error == ErrorPy3
else:
from bodyduration.models._models import Error as ErrorPy2
assert Error == ErrorPy2
from bodyduration.models._models_py3 import Error as ErrorPy3
assert Error == ErrorPy3

def test_operation_groups(self):
from bodyduration.operations import DurationOperations
Expand Down
8 changes: 2 additions & 6 deletions test/azure/legacy/AcceptanceTests/test_lro.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,12 +484,8 @@ def test_patch202_retry_with_async_and_location_header(self, client, product):
def test_models(self):
from lro.models import OperationResult

if sys.version_info >= (3,5):
from lro.models._models_py3 import OperationResult as OperationResultPy3
assert OperationResult == OperationResultPy3
else:
from lro.models._models import OperationResult as OperationResultPy2
assert OperationResult == OperationResultPy2
from lro.models._models_py3 import OperationResult as OperationResultPy3
assert OperationResult == OperationResultPy3

def test_operation_groups(self):
from lro.operations import LRORetrysOperations
Expand Down
9 changes: 2 additions & 7 deletions test/azure/legacy/AcceptanceTests/test_paging.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ def test_initial_response_no_items(self, client):
items = [i for i in pages]
assert len(items) == 1

@pytest.mark.skipif(sys.version_info < (3,5), reason="2.7 does different url encoding")
def test_duplicate_params(self, client):
pages = list(client.paging.duplicate_params(filter="foo"))
assert len(pages) == 1
Expand All @@ -189,12 +188,8 @@ def test_duplicate_params(self, client):

def test_models(self):
from paging.models import OperationResult
if sys.version_info >= (3,5):
from paging.models._models_py3 import OperationResult as OperationResultPy3
assert OperationResult == OperationResultPy3
else:
from paging.models._models import OperationResult as OperationResultPy2
assert OperationResult == OperationResultPy2
from paging.models._models_py3 import OperationResult as OperationResultPy3
assert OperationResult == OperationResultPy3

def test_operation_groups(self):
from paging.operations import PagingOperations
Expand Down
8 changes: 2 additions & 6 deletions test/azure/legacy/AcceptanceTests/test_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,8 @@ def test_azure_odata(self, azure_client):
def test_models(self):
from azureparametergrouping.models import Error

if sys.version_info >= (3,5):
from azureparametergrouping.models._models_py3 import Error as ErrorPy3
assert Error == ErrorPy3
else:
from azureparametergrouping.models._models import Error as ErrorPy2
assert Error == ErrorPy2
from azureparametergrouping.models._models_py3 import Error as ErrorPy3
assert Error == ErrorPy3

def test_operation_groups(self):
from azurespecialproperties.operations import ApiVersionDefaultOperations
Expand Down
8 changes: 2 additions & 6 deletions test/azure/legacy/AcceptanceTests/test_xms.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,5 @@ def test_xms_custom_named_request_id_parameter_group(self, client):
def test_models(self):
from azurespecialproperties.models import Error

if sys.version_info >= (3,5):
from azurespecialproperties.models._models_py3 import Error as ErrorPy3
assert Error == ErrorPy3
else:
from azurespecialproperties.models._models import Error as ErrorPy2
assert Error == ErrorPy2
from azurespecialproperties.models._models_py3 import Error as ErrorPy3
assert Error == ErrorPy3
8 changes: 1 addition & 7 deletions test/azure/low-level/AcceptanceTests/asynctests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,4 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
# --------------------------------------------------------------------------

import sys
import pytest

pytestmark = pytest.mark.skipif(sys.version_info < (3,6),
reason="requires python3.6")
# --------------------------------------------------------------------------
5 changes: 0 additions & 5 deletions test/azure/low-level/AcceptanceTests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ def testserver():
yield
terminate_server_process(server)

# Ignore collection of async tests for Python 2
collect_ignore = []
if sys.version_info < (3,5):
collect_ignore.append("asynctests")

@pytest.fixture()
def base_send_request():
def send_request(client, request, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,4 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
# --------------------------------------------------------------------------

import sys
import pytest

pytestmark = pytest.mark.skipif(sys.version_info < (3,6),
reason="requires python3.6")
# --------------------------------------------------------------------------
5 changes: 0 additions & 5 deletions test/azure/version-tolerant/AcceptanceTests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ def testserver():
yield
terminate_server_process(server)

# Ignore collection of async tests for Python 2
collect_ignore = []
if sys.version_info < (3,5):
collect_ignore.append("asynctests")


class CookiePolicy(SansIOHTTPPolicy):
def __init__(self, *args, **kwargs):
Expand Down
5 changes: 0 additions & 5 deletions test/dpg/low-level/AcceptanceTests/asynctests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,3 @@ async def send_request(client, request):
response.raise_for_status()
return response
return send_request

# Ignore collection of async tests for Python 2
collect_ignore = []
if sys.version_info < (3,5):
collect_ignore.append("asynctests")
5 changes: 0 additions & 5 deletions test/dpg/low-level/AcceptanceTests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,3 @@ def send_request(client, request):
response.raise_for_status()
return response
return send_request

# Ignore collection of async tests for Python 2
collect_ignore = []
if sys.version_info < (3,5):
collect_ignore.append("asynctests")
5 changes: 0 additions & 5 deletions test/dpg/version-tolerant/AcceptanceTests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,3 @@ def testserver():
server = start_server_process()
yield
terminate_server_process(server)

# Ignore collection of async tests for Python 2
collect_ignore = []
if sys.version_info < (3,5):
collect_ignore.append("asynctests")
5 changes: 0 additions & 5 deletions test/multiapi/AcceptanceTests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ def testserver():
yield
terminate_server_process(server)

# Ignore collection of async tests for Python 2
collect_ignore = []
if sys.version_info < (3,5):
collect_ignore.append("asynctests")

@pytest.fixture
def credential():
class FakeCredential:
Expand Down
6 changes: 0 additions & 6 deletions test/vanilla/legacy/AcceptanceTests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ def testserver():
yield
terminate_server_process(server)

# Ignore collection of async tests for Python 2
collect_ignore = []
if sys.version_info < (3,5):
collect_ignore.append("asynctests")


class CookiePolicy(SansIOHTTPPolicy):
def __init__(self, *args, **kwargs):
self._current_cookie = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,8 @@ def test_create_ap_in_properties_with_ap_string(self, client):

def test_models(self):
from additionalproperties.models import Error

if sys.version_info >= (3,5):
from additionalproperties.models._models_py3 import Error as ErrorPy3
assert Error == ErrorPy3
else:
from additionalproperties.models._models import Error as ErrorPy2
assert Error == ErrorPy2
from additionalproperties.models._models_py3 import Error as ErrorPy3
assert Error == ErrorPy3

def test_operation_groups(self):
from additionalproperties.operations import PetsOperations
Expand Down
10 changes: 3 additions & 7 deletions test/vanilla/legacy/AcceptanceTests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,18 +284,14 @@ def test_array_string_enum_valid(self, client):
def test_models(self):
from bodyarray.models import Error

if sys.version_info >= (3,5):
from bodyarray.models._models_py3 import Error as ErrorPy3
assert Error == ErrorPy3
else:
from bodyarray.models._models import Error as ErrorPy2
assert Error == ErrorPy2
from bodyarray.models._models_py3 import Error as ErrorPy3
assert Error == ErrorPy3

def test_operation_groups(self):
from bodyarray.operations import ArrayOperations

with pytest.raises(ImportError):
from bodyarray.operations import _array_operations_py3

from bodyarray.operations._array_operations import ArrayOperations as ArrayOperationsPy2
assert ArrayOperations == ArrayOperationsPy2
Loading

0 comments on commit be8ef9b

Please sign in to comment.