Disabled the cache related tests, no longer apply.

This commit is contained in:
Salvador E. Tropea 2020-10-17 14:30:23 -03:00
parent f96f56f0ee
commit a62c3440e3
1 changed files with 42 additions and 45 deletions

View File

@ -29,12 +29,9 @@ pytest-3 --log-cli-level debug
"""
import os
import stat
import sys
import shutil
import logging
from subprocess import call
from glob import glob
# Look for the 'utils' module from where the script is running
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if prev_dir not in sys.path:
@ -473,48 +470,48 @@ def test_pcbdraw_fail():
# This test was designed for `mcpy`.
# `mcpyrate` can pass it using Python 3.8.6, but seems to have problems on the docker image
def test_import_fail():
ctx = context.TestContext('test_import_fail', '3Rs', 'pre_and_position', POS_DIR)
# Create a read only cache entry that we should delete
call(['py3compile', 'kibot/out_any_layer.py'])
cache_dir = os.path.join('kibot', '__pycache__')
cache_file = glob(os.path.join(cache_dir, 'out_any_layer.*'))[0]
os.chmod(cache_file, stat.S_IREAD)
os.chmod(cache_dir, stat.S_IREAD | stat.S_IEXEC)
try:
# mcpyrate: not a problem, for Python 3.8.6
ret_code = 0
# mcpy:
# ret_code = WRONG_INSTALL
# Run the command
ctx.run(ret_code, extra=['--help-list-outputs'], no_out_dir=True, no_yaml_file=True, no_board_file=True)
finally:
os.chmod(cache_dir, stat.S_IREAD | stat.S_IWRITE | stat.S_IEXEC)
os.remove(cache_file)
if False:
# mcpy
assert ctx.search_err('Wrong installation')
assert ctx.search_err('Unable to import plug-ins')
ctx.clean_up()
def test_import_no_fail():
ctx = context.TestContext('test_import_no_fail', '3Rs', 'pre_and_position', POS_DIR)
# Create a cache entry that we should delete
call(['py3compile', 'kibot/out_any_layer.py'])
cache_dir = os.path.join('kibot', '__pycache__')
cache_file = glob(os.path.join(cache_dir, 'out_any_layer.*'))[0]
try:
# Run the command
ctx.run(extra=['--help-list-outputs'], no_out_dir=True, no_yaml_file=True, no_board_file=True)
if False:
# mcpy
assert not os.path.isfile(cache_file)
finally:
if os.path.isfile(cache_file):
os.remove(cache_file)
ctx.clean_up()
# `mcpyrate` can pass it using Python 3.8.6, but seems to have problems on the docker image.
# def test_import_fail():
# ctx = context.TestContext('test_import_fail', '3Rs', 'pre_and_position', POS_DIR)
# # Create a read only cache entry that we should delete
# call(['py3compile', 'kibot/out_any_layer.py'])
# cache_dir = os.path.join('kibot', '__pycache__')
# cache_file = glob(os.path.join(cache_dir, 'out_any_layer.*'))[0]
# os.chmod(cache_file, stat.S_IREAD)
# os.chmod(cache_dir, stat.S_IREAD | stat.S_IEXEC)
# try:
# # mcpyrate: not a problem, for Python 3.8.6
# ret_code = 0
# # mcpy:
# # ret_code = WRONG_INSTALL
# # Run the command
# ctx.run(ret_code, extra=['--help-list-outputs'], no_out_dir=True, no_yaml_file=True, no_board_file=True)
# finally:
# os.chmod(cache_dir, stat.S_IREAD | stat.S_IWRITE | stat.S_IEXEC)
# os.remove(cache_file)
# if False:
# # mcpy
# assert ctx.search_err('Wrong installation')
# assert ctx.search_err('Unable to import plug-ins')
# ctx.clean_up()
#
#
# def test_import_no_fail():
# ctx = context.TestContext('test_import_no_fail', '3Rs', 'pre_and_position', POS_DIR)
# # Create a cache entry that we should delete
# call(['py3compile', 'kibot/out_any_layer.py'])
# cache_dir = os.path.join('kibot', '__pycache__')
# cache_file = glob(os.path.join(cache_dir, 'out_any_layer.*'))[0]
# try:
# # Run the command
# ctx.run(extra=['--help-list-outputs'], no_out_dir=True, no_yaml_file=True, no_board_file=True)
# if False:
# # mcpy
# assert not os.path.isfile(cache_file)
# finally:
# if os.path.isfile(cache_file):
# os.remove(cache_file)
# ctx.clean_up()
def test_wrong_global_redef():