Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 24 additions & 28 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,18 @@
import os
import sys

sys.path.append(
os.path.join(os.path.dirname(__file__), '..', '..', 'src')
)
sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "src"))

# -- Project information -----------------------------------------------------

project = 'Fixate'
copyright = '2018, Clint Lawrence, Ryan Parry-Jones'
author = 'Clint Lawrence'
project = "Fixate"
copyright = "2018, Clint Lawrence, Ryan Parry-Jones"
author = "Clint Lawrence"

# The short X.Y version
version = ''
version = ""
# The full version, including alpha/beta/rc tags
release = ''
release = ""


# -- General configuration ---------------------------------------------------
Expand All @@ -40,20 +38,19 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc'
]
extensions = ["sphinx.ext.autodoc"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -76,7 +73,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
html_theme = "alabaster"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down Expand Up @@ -104,7 +101,7 @@
# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'Fixatedoc'
htmlhelp_basename = "Fixatedoc"


# -- Options for LaTeX output ------------------------------------------------
Expand All @@ -113,15 +110,12 @@
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -131,19 +125,15 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'Fixate.tex', 'Fixate Documentation',
'Clint Lawrence', 'manual'),
(master_doc, "Fixate.tex", "Fixate Documentation", "Clint Lawrence", "manual"),
]


# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'fixate', 'Fixate Documentation',
[author], 1)
]
man_pages = [(master_doc, "fixate", "Fixate Documentation", [author], 1)]


# -- Options for Texinfo output ----------------------------------------------
Expand All @@ -152,9 +142,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'Fixate', 'Fixate Documentation',
author, 'Fixate', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"Fixate",
"Fixate Documentation",
author,
"Fixate",
"One line description of project.",
"Miscellaneous",
),
]


Expand All @@ -173,4 +169,4 @@
# epub_uid = ''

# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
epub_exclude_files = ["search.html"]
42 changes: 24 additions & 18 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@

BASE_LOCATION = os.path.abspath(os.path.dirname(__file__))

VERSION_FILE = os.path.join(BASE_LOCATION, 'src', 'fixate', '__init__.py')
REQUIRES_FILE = 'requirements.txt'
VERSION_FILE = os.path.join(BASE_LOCATION, "src", "fixate", "__init__.py")
REQUIRES_FILE = "requirements.txt"
DEPENDENCIES_FILE = None


def filter_comments(fd):
no_comments = list(filter(lambda l: l.strip().startswith("#") is False, fd.readlines()))
no_comments = list(
filter(lambda l: l.strip().startswith("#") is False, fd.readlines())
)
return list(filter(lambda l: l.strip().startswith("-") is False, no_comments))


Expand All @@ -22,15 +24,18 @@ def readfile(filename, func):
with open(os.path.join(BASE_LOCATION, filename)) as f:
data = func(f)
except (IOError, IndexError):
sys.stderr.write(u"""
sys.stderr.write(
u"""
Can't find '%s' file. This doesn't seem to be a valid release.
""" % filename)
"""
% filename
)
sys.exit(1)
return data


def get_version():
with open(VERSION_FILE, 'r') as f:
with open(VERSION_FILE, "r") as f:
data = f.read()
m = re.search(r"__version__ ?= ?\"[\d.]+\"", data)
res = m.group(0)
Expand All @@ -54,20 +59,21 @@ def get_dependencies():
author="Ryan Parry-Jones",
author_email="ryanspj+github@gmail.com",
description="Framework for hardware test fixtures and automated test environments",
package_dir={'': 'src'},
packages=find_packages('src'),
package_dir={"": "src"},
packages=find_packages("src"),
scripts=[],
url="http://pyfixate.com/",
version=get_version(),
install_requires=["pyvisa",
"pypubsub",
# "pyqt5", # Required for the QT GUI
"pynput",
"ruamel.yaml",
"pyserial",
"cmd2", # required for fxconfig
],
python_requires='~=3.4',
install_requires=[
"pyvisa",
"pypubsub",
# "pyqt5", # Required for the QT GUI
"pynput",
"ruamel.yaml",
"pyserial",
"cmd2", # required for fxconfig
],
python_requires="~=3.4",
dependency_links=[],
include_package_data=True,
zip_safe=False,
Expand All @@ -76,7 +82,7 @@ def get_dependencies():
"Intended Audience :: Manufacturing",
"License :: OSI Approved :: MIT License",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python :: 3 :: Only"
"Programming Language :: Python :: 3 :: Only",
],
entry_points="""
[console_scripts]
Expand Down
2 changes: 1 addition & 1 deletion src/fixate/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def tear_down(self):
Optionally override this code that is always executed at the end of the test whether it was successful or not
"""

def test(self):
def test(self, **kwargs):
"""
This method should be overridden with the test code
This is the test sequence code
Expand Down
16 changes: 4 additions & 12 deletions src/fixate/drivers/daq/daqmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@


class DaqTask:
"""

"""
""""""

task_state = ""
task = None
Expand Down Expand Up @@ -115,9 +113,7 @@ def start(self):


class DigitalOut(DaqTask):
"""

"""
""""""

def __init__(self, task_string, io_length):
self.io_length = io_length
Expand Down Expand Up @@ -189,9 +185,7 @@ def write(self, data):


class DigitalIn(DaqTask):
"""

"""
""""""

def __init__(self, task_string, io_length):
self.io_length = io_length
Expand Down Expand Up @@ -226,9 +220,7 @@ def read(self):


class BufferedWrite(DaqTask):
"""

"""
""""""

def __init__(self, task_string, io_length, frequency):
self.task_string = task_string
Expand Down
12 changes: 6 additions & 6 deletions src/fixate/drivers/ftdi.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,12 @@ def baud_rate(self, rate):

def write_bit_mode(self, mask, validate=False):
"""
handle; gained from device info
mask; value to write for the mask
for BIT_MODE.FT_BITMODE_CBUS_BITBANG
upper nibble is input (0) output (1)
lower nibble is pin value low (0) high (1)
bit_mode; Type BIT_MODE
handle; gained from device info
mask; value to write for the mask
for BIT_MODE.FT_BITMODE_CBUS_BITBANG
upper nibble is input (0) output (1)
lower nibble is pin value low (0) high (1)
bit_mode; Type BIT_MODE
"""
check_return(ftdI2xx.FT_SetBitMode(self.handle, UCHAR(mask), self.bit_mode))
data_bus = UCHAR()
Expand Down
83 changes: 83 additions & 0 deletions src/fixate/examples/shared_test_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
from fixate.core.ui import user_info
from fixate.core.common import TestClass, TestList
import fixate

__version__ = "2"

seq = fixate.config.RESOURCES["SEQUENCER"]


class TestListOuter(TestList):
outer: int
other_data: float

def __init__(self, seq, *, outer: int = 5):
super(TestListOuter, self).__init__(seq)
self.outer = outer

def enter(self):
self.other_data = 0.5


class TestListInner(TestList):
inner: int
other_data: str

def enter(self):
self.inner = 10
self.other_data = "Hello"


class TestListNotRun(TestList):
other_data: int


class TestOuter(TestClass):
def test(self, outer_list: TestListOuter):
user_info(f"Outer.outer: {outer_list.outer}")
user_info(f"Outer.other: {outer_list.other_data}")


class TestBoth(TestClass):
def test(self, outer_list: TestListOuter, inner_list: TestListInner):
user_info(f"Outer.outer: {outer_list.outer}")
user_info(f"Outer.other: {outer_list.other_data}")
user_info(f"Inner.inner: {inner_list.inner}")
user_info(f"Inner.other: {inner_list.other_data}")


class TestOther(TestClass):
def test(
self,
outer_list: TestListOuter,
inner_list: TestListInner,
not_run: TestListNotRun,
):
user_info(f"Outer.outer: {outer_list.outer}")
user_info(f"Outer.other: {outer_list.other_data}")
user_info(f"Inner.inner: {inner_list.inner}")
user_info(f"Inner.other: {inner_list.other_data}")


test_data = {
"standard": TestList([TestListOuter([TestListInner([TestBoth()])])]),
# Should fail as TestListNotRun in not run
"test_not_run": TestList([TestListOuter([TestListInner([TestOther()])])]),
# Should fail as TestBoth doesn't have TestListOuter in scope
"list_out_of_scope": TestList(
[TestListOuter([TestOuter()]), TestListInner([TestBoth()])]
),
# Should use the inner most match to the test list. First TestOuter should print 10, second should print 20
# Eg. 1.1 Outer.outer: 10, 1.2.1 Outer.outer: 20
"used_multi_level": TestList(
[
TestListOuter(
[
TestOuter(),
TestListOuter([TestOuter()], outer=20),
],
outer=10,
)
]
),
}
4 changes: 3 additions & 1 deletion src/fixate/reporting/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ def test(self):


class CSVWriter:
def __init__(self,):
def __init__(
self,
):
self.csv_queue = Queue()
self.csv_writer = None
# data = fixate.config.get_config_dict()
Expand Down
Loading