Skip to content
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
41 changes: 24 additions & 17 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ stages:
- bash: |
set -e
python -m pip install --upgrade pip
pip install cibuildwheel==1.3.0
pip install cibuildwheel==1.6.3
pip install -U twine
cibuildwheel --output-dir wheelhouse .
- task: PublishBuildArtifacts@1
Expand Down Expand Up @@ -68,7 +68,7 @@ stages:
TWINE_PASSWORD: $(TWINE_PASSWORD)
- job: 'macos'
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
pool: {vmImage: 'macOS-10.15'}
pool: {vmImage: 'macOS-latest'}
variables:
python.version: '3.7'
CIBW_BEFORE_BUILD: pip install -U Cython
Expand All @@ -80,7 +80,7 @@ stages:
- bash: |
set -e
python -m pip install --upgrade pip
pip install cibuildwheel==1.3.0
pip install cibuildwheel==1.6.3
pip install -U twine
cibuildwheel --output-dir wheelhouse .
- task: PublishBuildArtifacts@1
Expand All @@ -105,12 +105,14 @@ stages:
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.7', architecture: x64}}
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.8', architecture: x86}}
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.8', architecture: x64}}
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.9', architecture: x86}}
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.9', architecture: x64}}
- script: choco install vcpython27 -f -y
displayName: Install Visual C++ for Python 2.7
- bash: |
set -e
python -m pip install --upgrade pip
pip install cibuildwheel==1.3.0
pip install cibuildwheel==1.6.3
pip install -U twine
cibuildwheel --output-dir wheelhouse
- task: PublishBuildArtifacts@1
Expand All @@ -124,7 +126,7 @@ stages:
dependsOn: []
jobs:
- job: 'Linux_Tests'
pool: {vmImage: 'ubuntu-16.04'}
pool: {vmImage: 'ubuntu-latest'}
strategy:
matrix:
Python37:
Expand Down Expand Up @@ -154,7 +156,7 @@ stages:
source test-job/bin/activate
pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt
pip install -c constraints.txt .
pip install "qiskit-ibmq-provider" "qiskit-aer" "z3-solver" -c constraints.txt
pip install "qiskit-aer" "z3-solver" -c constraints.txt
python setup.py build_ext --inplace
sudo apt install -y graphviz
pip check
Expand Down Expand Up @@ -192,7 +194,7 @@ stages:
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Test results for Linux Python $(python.version)'
- job: 'Lint'
pool: {vmImage: 'ubuntu-16.04'}
pool: {vmImage: 'ubuntu-latest'}
strategy:
matrix:
Python37:
Expand Down Expand Up @@ -220,7 +222,7 @@ stages:
source test-job/bin/activate
pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt
pip install -c constraints.txt -e .
pip install "qiskit-ibmq-provider" "qiskit-aer" -c constraints.txt
pip install "qiskit-aer" -c constraints.txt
python setup.py build_ext --inplace
displayName: 'Install dependencies'
- bash: |
Expand All @@ -232,7 +234,7 @@ stages:
reno lint
displayName: 'Style and lint'
- job: 'Docs'
pool: {vmImage: 'ubuntu-16.04'}
pool: {vmImage: 'ubuntu-latest'}
strategy:
matrix:
Python37:
Expand Down Expand Up @@ -278,7 +280,7 @@ stages:
Parallel: true
ParallelCount: 8
- job: 'MacOS_Catalina_Tests'
pool: {vmImage: 'macOS-10.15'}
pool: {vmImage: 'macOS-latest'}
strategy:
matrix:
Python37:
Expand Down Expand Up @@ -308,7 +310,7 @@ stages:
source test-job/bin/activate
pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt
pip install -c constraints.txt -e .
pip install "qiskit-ibmq-provider" "qiskit-aer" -c constraints.txt
pip install "qiskit-aer" -c constraints.txt
python setup.py build_ext --inplace
pip check
displayName: 'Install dependencies'
Expand Down Expand Up @@ -348,7 +350,7 @@ stages:
condition: and(succeeded('Lint_and_Tests'), not(startsWith(variables['Build.SourceBranch'], 'refs/tags')))
jobs:
- job: 'Windows_Tests'
pool: {vmImage: 'vs2017-win2016'}
pool: {vmImage: 'windows-latest'}
strategy:
matrix:
Python36:
Expand All @@ -357,6 +359,8 @@ stages:
python.version: '3.7'
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
variables:
QISKIT_SUPPRESS_PACKAGING_WARNINGS: Y
QISKIT_TEST_CAPTURE_STREAMS: 1
Expand All @@ -372,7 +376,7 @@ stages:
source test-job/Scripts/activate
pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt
pip install -c constraints.txt -e .
pip install "qiskit-ibmq-provider" "qiskit-aer" "z3-solver" -c constraints.txt
pip install "z3-solver" -c constraints.txt
python setup.py build_ext --inplace
pip check
displayName: 'Install dependencies'
Expand Down Expand Up @@ -409,13 +413,15 @@ stages:
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Test results for Windows Python $(python.version)'
- job: 'Linux_Tests'
pool: {vmImage: 'ubuntu-16.04'}
pool: {vmImage: 'ubuntu-latest'}
strategy:
matrix:
Python36:
python.version: '3.6'
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
variables:
QISKIT_SUPPRESS_PACKAGING_WARNINGS: Y
PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
Expand All @@ -441,7 +447,7 @@ stages:
source test-job/bin/activate
pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt
pip install -c constraints.txt -e .
pip install "qiskit-ibmq-provider" "qiskit-aer" "z3-solver" -c constraints.txt
pip install "qiskit-aer" "z3-solver" -c constraints.txt
python setup.py build_ext --inplace
sudo apt install -y graphviz
pip check
Expand Down Expand Up @@ -479,13 +485,15 @@ stages:
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Test results for Linux Python $(python.version)'
- job: 'MacOS_Catalina_Tests'
pool: {vmImage: 'macOS-10.15'}
pool: {vmImage: 'macOS-latest'}
strategy:
matrix:
Python36:
python.version: '3.6'
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
variables:
QISKIT_SUPPRESS_PACKAGING_WARNINGS: Y
PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
Expand All @@ -511,7 +519,6 @@ stages:
source test-job/bin/activate
pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt
pip install -c constraints.txt -e .
pip install "qiskit-ibmq-provider" "qiskit-aer" -c constraints.txt
python setup.py build_ext --inplace
pip check
displayName: 'Install dependencies'
Expand Down
10 changes: 1 addition & 9 deletions qiskit/test/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
HAS_FIXTURES = False

from .runtest import RunTest, MultipleExceptions
from .utils import Path, _AssertNoLogsContext, setup_test_logging
from .utils import Path, setup_test_logging


__unittest = True # Allows shorter stack trace for .assertDictAlmostEqual
Expand Down Expand Up @@ -98,14 +98,6 @@ def _get_resource_path(filename, path=Path.TEST):
"""
return os.path.normpath(os.path.join(path.value, filename))

def assertNoLogs(self, logger=None, level=None):
"""Assert that no message is sent to the specified logger and level.

Context manager to test that no message is sent to the specified
logger and level (the opposite of TestCase.assertLogs()).
"""
return _AssertNoLogsContext(self, logger, level)

def assertDictAlmostEqual(self, dict1, dict2, delta=None, msg=None,
places=None, default_value=0):
"""Assert two dictionaries with numeric values are almost equal.
Expand Down
27 changes: 0 additions & 27 deletions qiskit/test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import logging
import os
import unittest
from enum import Enum
from itertools import product

Expand Down Expand Up @@ -66,32 +65,6 @@ def setup_test_logging(logger, log_level, filename):
logger.setLevel(level)


class _AssertNoLogsContext(unittest.case._AssertLogsContext):
"""A context manager used to implement TestCase.assertNoLogs()."""

# pylint: disable=inconsistent-return-statements
def __exit__(self, exc_type, exc_value, tb):
"""
This is a modified version of TestCase._AssertLogsContext.__exit__(...)
"""
self.logger.handlers = self.old_handlers
self.logger.propagate = self.old_propagate
self.logger.setLevel(self.old_level)
if exc_type is not None:
# let unexpected exceptions pass through
return False

if self.watcher.records:
msg = 'logs of level {} or higher triggered on {}:\n'.format(
logging.getLevelName(self.level), self.logger.name)
for record in self.watcher.records:
msg += 'logger %s %s:%i: %s\n' % (record.name, record.pathname,
record.lineno,
record.getMessage())

self._raiseFailure(msg)


class Case(dict):
"""<no description>"""
pass
Expand Down
5 changes: 5 additions & 0 deletions releasenotes/notes/python39-617f3ed823e63cfe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
features:
- |
Python 3.9 support has been added in this release. You can now run Qiskit
Terra using Python 3.9.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Scientific/Engineering",
],
keywords="qiskit sdk quantum",
Expand Down
4 changes: 2 additions & 2 deletions test/python/tools/jupyter/test_notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def _execute_notebook(self, filename):
notebook, {'metadata': {'path': self.execution_path}})

@unittest.skipIf(
sys.version_info[0] == 3 and sys.version_info[1] == 8 and
sys.platform != 'linux', 'Fails with Python 3.8 on osx and windows')
sys.version_info >= (3, 8) and
sys.platform != 'linux', 'Fails with Python >=3.8 on osx and windows')
def test_jupyter_jobs_pbars(self):
"""Test Jupyter progress bars and job status functionality"""
self._execute_notebook(self._get_resource_path(
Expand Down