Swift: removed spurious mock import

This commit is contained in:
Paolo Tranquilli
2022-04-27 09:09:57 +02:00
parent 68231bfc27
commit 7f0476049f
3 changed files with 7 additions and 10 deletions

View File

@@ -1,12 +1,13 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: /test/.*$(?<!\.ql)(?<!\.qll)(?<!\.qlref)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
exclude: /test/.*$(?<!\.ql)(?<!\.qll)(?<!\.qlref)
- id: end-of-file-fixer
exclude: /test/.*$(?<!\.ql)(?<!\.qll)(?<!\.qlref)
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v13.0.1
@@ -24,6 +25,7 @@ repos:
- id: sync-files
name: Fix files required to be identical
files: \.(qll?|qhelp)$
language: system
entry: python3 config/sync-files.py --latest
pass_filenames: false
@@ -43,7 +45,7 @@ repos:
- id: swift-codegen-unit-tests
name: Run Swift code generation unit tests
files: ^swift/codegen
files: ^swift/codegen/.*\.py$
language: system
entry: bazel test //swift/codegen:tests
pass_filenames: false

View File

@@ -1,8 +1,6 @@
import subprocess
import sys
import mock
from swift.codegen import qlgen
from swift.codegen.lib import ql, paths
from swift.codegen.test.utils import *

View File

@@ -1,24 +1,21 @@
import io
import pathlib
import sys
import mock
import pytest
import swift.codegen.lib.schema as schema
from swift.codegen.test.utils import *
root_name = schema.root_class_name
@pytest.fixture
def load(tmp_path):
file = tmp_path / "schema.yml"
def ret(yml):
write(file, yml)
return schema.load(file)
return ret
def test_empty_schema(load):
ret = load("{}")
assert ret.classes == [schema.Class(root_name)]