Skip to main content
Ctrl+K

canary 26.4.16

  • User's guide
  • API reference
  • Developer's guide
  • Release notes
  • Tutorial
  • GitHub
  • User's guide
  • API reference
  • Developer's guide
  • Release notes
  • Tutorial
  • GitHub

Section Navigation

  • Introduction
    • What is canary?
    • Installing canary
    • Getting the examples
  • Getting started
    • A first test
    • A second test
    • Other test file types
  • Parameterizing tests
    • Getting started
    • Multiple parameters
    • Combining multiple parameter sets
    • Special parameter names
    • Different types of parameterization
  • Test asset management
    • Copy files into the test's working directory
    • Link files into the test's working directory
  • Test dependencies
    • Basic test dependencies
    • Controlling test execution based on dependency results
    • Establishing dependencies on specific test parameterizations
    • Multiple dependencies
    • Generating the base case
  • Resource allocation
    • The resource pool
    • Defining the resource pool
    • Defining resources required by a test case
    • Environment variables
  • Batched execution
    • Running tests in a batch scheduler
    • Sending options to the batch scheduler
  • canary: Accelerating Application Testing Across Platforms
  • Test asset management
  • Link files into the test working directory

Link files into the test working directory#

The canary.directives.link() directive links files into the test’s working directory:

# Copyright NTESS. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: MIT

import os

import canary

canary.directives.copy("copy.txt")
canary.directives.link("link.txt")


def test():
    assert os.path.exists("copy.txt") and not os.path.islink("copy.txt")
    assert os.path.exists("link.txt") and os.path.islink("link.txt")

Relative paths are assumed relative to the test file’s source directory.

previous

Copy files into the test working directory

next

Test dependencies

© Copyright 2024, National Technology & Engineering Solutions of Sandia, LLC (NTESS).

Created using Sphinx 9.1.0.

Built with the PyData Sphinx Theme 0.17.1.