0

I'm creating a new testing frameworks, I started to implement my own functions in *.py files, but when I try to run test, I've got following stack:

(venv) PLAMWS0024:OAT user$ robot -v CONFIG_FILE:"/variables-config.robot" ./catalog/tests/test1.robot
Traceback (most recent call last):
  File "/Users/user/PycharmProjects/OAT/venv/bin/robot", line 5, in <module>
    from robot.run import run_cli
  File "/Users/user/PycharmProjects/OAT/venv/lib/python3.8/site-packages/robot/__init__.py", line 44, in <module>
    from robot.rebot import rebot, rebot_cli
  File "/Users/user/PycharmProjects/OAT/venv/lib/python3.8/site-packages/robot/rebot.py", line 45, in <module>
    from robot.run import RobotFramework
  File "/Users/user/PycharmProjects/OAT/venv/lib/python3.8/site-packages/robot/run.py", line 44, in <module>
    from robot.running.builder import TestSuiteBuilder
  File "/Users/user/PycharmProjects/OAT/venv/lib/python3.8/site-packages/robot/running/__init__.py", line 98, in <module>
    from .builder import TestSuiteBuilder, ResourceFileBuilder
  File "/Users/user/PycharmProjects/OAT/venv/lib/python3.8/site-packages/robot/running/builder/__init__.py", line 16, in <module>
    from .builders import TestSuiteBuilder, ResourceFileBuilder
  File "/Users/user/PycharmProjects/OAT/venv/lib/python3.8/site-packages/robot/running/builder/builders.py", line 20, in <module>
    from robot.parsing import SuiteStructureBuilder, SuiteStructureVisitor
  File "/Users/user/PycharmProjects/OAT/venv/lib/python3.8/site-packages/robot/parsing/__init__.py", line 380, in <module>
    from .model import ModelTransformer, ModelVisitor
  File "/Users/user/PycharmProjects/OAT/venv/lib/python3.8/site-packages/robot/parsing/model/__init__.py", line 18, in <module>
    from .statements import Statement
  File "/Users/user/PycharmProjects/OAT/venv/lib/python3.8/site-packages/robot/parsing/model/statements.py", line 453, in <module>
    class Error(Statement, Exception):
TypeError: multiple bases have instance lay-out conflict

I suspect it's because in one of my files I'm trying to get variables from Robot Framework built in functionalities. and I'm thinking it's because I'm trying to use protected methods, but I am not sure.

I found issue TypeError: multiple bases have instance lay-out conflict and it shows that there might be a mismatch in naming convention (or am I wrong?), but my project is a bit small, so the only option is that Robot can't see the function itself.

What can I miss?

Some code:

Test itself:

*** Settings ***
Documentation     TO BE CHANGED
...               SET IT TO CORRECT DESCRIPTION
Library           ${EXECDIR}/file.py
Library           String

*** Test Cases ***
User can do stuff
    foo bar

from datetime import datetime
from robot.api import logger
from robot.libraries.BuiltIn import _Variables
from robot.parsing.model.statements import Error
import json
import datetime
from catalog.resources.utils.clipboardContext import get_value_from_clipboard

Vars = _Variables()


def foo_bar(params):
    # Get all variables
    country = get_value_from_clipboard('${COUNTRY}')
    address = get_value_from_clipboard('${ADDRESS}')
    city = get_value_from_clipboard('${CITY}')
    postcode = get_value_from_clipboard('${POSTALCODE}')

And calling Vars:

from robot.libraries.BuiltIn import _Variables
from robot.parsing.model.statements import Error
Vars = _Variables()


def get_value_from_clipboard(name):
    """
    Returns value saved inside variables passed in Robot Framework
    :param name: name of the variable, needs to have ${} part
            as example: ${var} passed in config file
    :return: value itself, passed as string
    """
    try:
        return Vars.get_variable_value(name)
    except Error as e:
        raise Error('Missing parameter in the clipboard, stack:' + str(e))
Michal
  • 443
  • 1
  • 10
  • 25

1 Answers1

0

What fixed issue:

  • uninstall all requirements from requirements.txt file and install all one-by-one.

Additional steps I tried:

  • comment out all files one-by-one and run only robot command - failed, got same errors
  • cleaned vnenv as described here: How to reset virtualenv and pip? (failed)
  • check out if any variable has same naming as described in python3.8/site-packages/robot/parsing/model/statements.py - none

So looks like there was some clash in installing requirements by PyCharm IDE

Michal
  • 443
  • 1
  • 10
  • 25