Skip to content

Conversation

@T-Nicholls
Copy link
Collaborator

This is pretty much everything that was left on my todo list for pytac.

If you remember we discovered that our errors were being chained rather than replaced, when using Python 3, e.g.

>>> lattice.get_value('not_a_field')
Traceback (most recent call last):
  File "/home/jzs47954/git/pytac/pytac/data_source.py", line 315, in get_value
    throw (bool): if True, ControlSystemException will be raised on
KeyError: 'not_a_field'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jzs47954/git/pytac/pytac/data_source.py", line 196, in get_value
    if units == pytac.DEFAULT:
  File "/home/jzs47954/git/pytac/pytac/data_source.py", line 318, in get_value
    Returns:
pytac.exceptions.FieldException: No field not_a_field on data source <pytac.data_source.DeviceDataSource object at 0x7fb0ba8a9cc0>.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jzs47954/git/pytac/pytac/lattice.py", line 174, in get_value
    try:
  File "/home/jzs47954/git/pytac/pytac/data_source.py", line 204, in get_value
    target=units)
pytac.exceptions.FieldException: No field not_a_field on manager <pytac.data_source.DataSourceManager object at 0x7fb0ba88c080>.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jzs47954/git/pytac/pytac/lattice.py", line 180, in get_value
    except FieldException:
pytac.exceptions.FieldException: Lattice <pytac.lattice.EpicsLattice object at 0x7fb0ba88c128> does not have field not_a_field on data source default

According to pep3134 this is the intended behaviour now; pep415 gives ways to avoid this, but they are not compatible with python 2.7 as far as I can tell. So for it seems like we are stuck with this behaviour.

@coveralls
Copy link

coveralls commented Mar 18, 2019

Coverage Status

Coverage increased (+0.0007%) to 99.846% when pulling ae630a6 on T-Nicholls:miscChanges into 48a2522 on dls-controls:master.

Copy link
Collaborator

@willrogers willrogers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good, I've made a few comments that you can respond to.

$ python -m pytest

To see a coverage report, check pep8 and pyflakes::
To see a coverage report, check pytest-cov::
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about:

To see a coverage report and style violations, you can use pytest-cov, pep8 and pyflakes:

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that we use flake8 instead of pep8 and pyflakes.
So perhaps:

To see a coverage report, check pytest-cov:
 $ python -m pytest --cov-report term-missing --cov=pytac

To see style violations, use flake8:
 $ flake8

Or we could use this plugin:

To see a coverage report and style violations, you can use pytest-cov and flake8:
 $ python -m pytest --cov-report term-missing --cov=pytac --flake8

@willrogers willrogers merged commit 5c1d93b into DiamondLightSource:master Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants