File: os_test.py

package info (click to toggle)
python-certbot 4.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,688 kB
  • sloc: python: 21,764; makefile: 182; sh: 108
file content (22 lines) | stat: -rw-r--r-- 604 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""Unit test for os module."""
import sys

import pytest

from certbot.compat import os


def test_forbidden_methods():
    # Checks for os module
    for method in ['chmod', 'chown', 'open', 'mkdir', 'makedirs', 'rename',
                   'replace', 'access', 'stat', 'fstat']:
        with pytest.raises(RuntimeError):
            getattr(os, method)()
    # Checks for os.path module
    for method in ['realpath']:
        with pytest.raises(RuntimeError):
            getattr(os.path, method)()


if __name__ == "__main__":
    sys.exit(pytest.main(sys.argv[1:] + [__file__]))  # pragma: no cover