1################################################################ 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance 9# with the License. You may obtain a copy of the License at 10# 11# http://www.apache.org/licenses/LICENSE-2.0 12# 13# Unless required by applicable law or agreed to in writing, 14# software distributed under the License is distributed on an 15# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16# KIND, either express or implied. See the License for the 17# specific language governing permissions and limitations 18# under the License. 19# 20################################################################ 21 22"""Against a real install, when AOO_OFFICE names one. Nothing here starts the office: it reads files and imports uno in a child Python.""" 23import os 24 25import pytest 26 27from aootest import install 28 29pytestmark = [pytest.mark.smoke, pytest.mark.skipif(not os.environ.get("AOO_OFFICE"), reason="set AOO_OFFICE to an installed AOO 5 to run this")] 30 31 32@pytest.fixture(scope="module") 33def layout(): 34 return install.discover() 35 36 37def test_layout_matches_the_version_file(layout): 38 text = layout.version_file.read_text() 39 assert "OOOBaseVersion=%s" % layout.version.base in text 40 assert layout.soffice.is_file() and layout.fundamental.is_file() and layout.pyuno_module is not None 41 assert layout.version.tuple >= install.MIN_VERSION 42 43 44def test_a_python_can_import_uno(layout, tmp_path): 45 try: 46 py = install.find_uno_python(layout, cache_file=tmp_path / "uno.json") 47 except install.NoUnoPython as e: 48 pytest.skip("no UNO Python for this install: %s; tried %s" % (e, e.tried)) 49 assert os.path.exists(py.path) and tuple(int(x) for x in py.version.split(".")[:2]) >= install.MIN_WORKER_PYTHON 50