コード例 #1
0
 def test_captures_exceptions(self):
     result = functions.stat_path('/does/not/exist')
     assert result['exception']['attributes']['errno'] == '2'
     assert result['exception']['name'] in ['FileNotFoundError', 'OSError']
コード例 #2
0
 def test_no_callables(self, tmpdir):
     result = functions.stat_path(str(tmpdir))
     for value in result.values():
         assert callable(value) is False
コード例 #3
0
 def test_stat_dir(self, tmpdir):
     result = functions.stat_path(str(tmpdir))
     assert result != {}
コード例 #4
0
    def test_exception_is_empty_on_success(self, tmpdir):
        filename = os.path.join(str(tmpdir), 'file')
        make_test_file(filename)

        result = functions.stat_path(filename)
        assert not result["exception"]
コード例 #5
0
    def test_includes_file_content(self, tmpdir):
        filename = os.path.join(str(tmpdir), 'file')
        make_test_file(filename, contents="foo")

        result = functions.stat_path(filename, get_contents=True)
        assert result["contents"] == "foo"
コード例 #6
0
    def test_stat_file_includes_group(self, tmpdir):
        filename = os.path.join(str(tmpdir), 'file')
        make_test_file(filename)

        result = functions.stat_path(filename)
        assert "group" in result