File: test_fileutil.py

package info (click to toggle)
python-skytools 3.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 620 kB
  • sloc: python: 6,394; ansic: 929; makefile: 38; awk: 14
file content (20 lines) | stat: -rw-r--r-- 392 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

import os
import tempfile

from skytools.fileutil import write_atomic


def test_write_atomic() -> None:
    pidfn = tempfile.mktemp('.pid')
    write_atomic(pidfn, "1")
    write_atomic(pidfn, "2")
    os.remove(pidfn)


def test_write_atomic_bak() -> None:
    pidfn = tempfile.mktemp('.pid')
    write_atomic(pidfn, "1", '.bak')
    write_atomic(pidfn, "2", '.bak')
    os.remove(pidfn)