4480ab5574
Pytest includes a fixture that can be used to generate temporary directories. Previously Pegleg had implemented a hombrewed version of a temporary directory fixture. This change removes the homebrewed version and replaces it with the tmpdir fixture. Implement tmpdir fixture in tests Upgrade all testing packages to use the latest features Removes unused imports and organizes import lists Removes mock package requirement and uses unittest.mock, included in python >3.3 Implements a slightly cleaner method to get proxy info Change-Id: If66e1cfba858d5fb8948529deb8fb2d32345f630
27 lines
985 B
Python
27 lines
985 B
Python
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
import logging
|
|
|
|
import pytest
|
|
from testfixtures import log_capture
|
|
|
|
from pegleg.engine import exceptions
|
|
|
|
|
|
@log_capture()
|
|
def test_exception_with_missing_kwargs(capture):
|
|
message = 'Testing missing kwargs exception with {text}'
|
|
with pytest.raises(exceptions.PeglegBaseException):
|
|
raise exceptions.PeglegBaseException(message=message, key="value")
|
|
capture.check(('pegleg.engine.exceptions', 'WARNING', 'Missing kwargs'))
|