File: test_version.py

package info (click to toggle)
fenics-dolfinx 1%3A0.10.0.post5-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,952 kB
  • sloc: cpp: 36,535; python: 25,391; makefile: 223; sh: 174; xml: 55
file content (30 lines) | stat: -rw-r--r-- 1,049 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Copyright (C) 2021-2025 Chris Richardson, Jørgen S. Dokken
#
# This file is part of DOLFINx (https://www.fenicsproject.org)
#
# SPDX-License-Identifier:    LGPL-3.0-or-later

from packaging.version import parse

import dolfinx


def test_version():
    """Test that installed Python version matches C++ version.

    Python DOLFINx follows `major.minor.micro` with the append of `.devx`
    and `.postx` denoting development and postrelease, respectively.

    C++ DOLFINx follows `major.minor.micro` with a development denoted
    `major.minor.micro.0`. postrelease cannot be reflected in C++,
    any changes to the C++ code should bump micro.
    """
    cpp_version = parse(dolfinx.cpp.__version__)
    python_version = parse(dolfinx.__version__)

    assert cpp_version.major == python_version.major
    assert cpp_version.minor == python_version.minor
    assert cpp_version.micro == python_version.micro

    cpp_is_devrelease = True if len(cpp_version.release) == 4 else False
    assert cpp_is_devrelease == python_version.is_devrelease