blob: f6a45cb99ab0eb1732817ec7f8353c6d881c4a55 [file] [log] [blame]
# -*- coding: utf-8 -*-
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Configuration and fixtures for pytest.
See the following doc link for an explanation of and how it is used
by pytest:
from __future__ import print_function
import pytest
import chromite as cr
def overlay_stack(tmp_path_factory):
"""Factory for stacked Portage overlays.
The factory function takes an integer argument and returns an iterator of
that many overlays, each of which has all prior overlays as masters.
def make_overlay_stack(height):
if not height <= len(cr.test.Overlay.HIERARCHY_NAMES):
raise ValueError(
'Overlay stacks taller than %s are not supported. Received: %s' %
(len(cr.test.Overlay.HIERARCHY_NAMES), height))
overlays = []
for i in range(height):
'overlay-' + cr.test.Overlay.HIERARCHY_NAMES[i]),
yield overlays[i]
return make_overlay_stack