File: test_version.py

package info (click to toggle)
pyreadstat 1.2.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,380 kB
  • sloc: ansic: 17,916; python: 1,065; makefile: 3
file content (39 lines) | stat: -rw-r--r-- 1,129 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
31
32
33
34
35
36
37
38
39
"""
Test if the version in pyreadstat __init__ matches the version in setup.py
"""

import os
import sys
import re

script_folder = os.path.split(os.path.split(os.path.realpath(__file__))[0])[0]
sys.path.insert(0, script_folder)
sys.path.insert(1,os.path.join(script_folder, "docs"))

import pyreadstat
import conf

pyreadstat_version = pyreadstat.__version__

with open(os.path.join(script_folder, "setup.py")) as h:
    content = h.read()

raw = re.findall("version=\'.*?\'", content)
setup_version = raw[0].replace("version=", "")
setup_version = setup_version.replace("'", "")

with open(os.path.join(script_folder, "CITATION.cff")) as h:
    content = h.readlines()
raw = [x for x in content if x.startswith("version")]
cff_version = raw[0].replace("version:", "").strip()

print("testing if module and setup versions match")
assert(pyreadstat_version == setup_version)
print("testing if documentation and setup versions match")
assert(conf.release == setup_version)
print("testing if cff and setup versions match")
assert(cff_version == setup_version)
print("all versions match!")