-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix attribute retrieval from version-dependent icephys #264
Changes from 7 commits
788a888
b3016a0
431f388
1231dca
9ce59ce
f158d33
071f167
a1ee11a
7045196
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Past PyNWB Version | ||
on: | ||
schedule: | ||
- cron: "0 0 * * *" # daily | ||
pull_request: | ||
|
||
jobs: | ||
build-and-test: | ||
name: Testing against past PyNWB versions | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
pynwb-version: ["2.1.0", "2.0.0"] | ||
steps: | ||
- uses: s-weigand/setup-conda@v1 | ||
with: | ||
update-conda: true | ||
python-version: 3.9 | ||
conda-channels: conda-forge | ||
- uses: actions/checkout@v2 | ||
- run: git fetch --prune --unshallow --tags | ||
- name: Install pytest | ||
run: | | ||
pip install pytest | ||
pip install pytest-cov | ||
- name: Install package | ||
run: | | ||
pip install -e . | ||
pip install pynwb==${{ matrix.pynwb-version }} | ||
- name: Run pytest with coverage | ||
run: pytest -rsx |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,5 @@ | |
@register_check(importance=Importance.BEST_PRACTICE_VIOLATION, neurodata_type=IntracellularElectrode) | ||
def check_intracellular_electrode_cell_id_exists(intracellular_electrode: IntracellularElectrode): | ||
"""Check if the IntracellularElectrode contains a cell_id.""" | ||
if intracellular_electrode.cell_id is None: | ||
if getattr(intracellular_electrode, "cell_id", "") is None: # Will only be None with PyNWB>=2.1.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand that this would work, but maybe a better option is to be a bit more explicit, using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about that but that is precisely the precedence that leads us down a rabbit hole in the future to having to figure out which parts of which tests depend on which version of PyNWB is being used at runtime. So it's a lot easier on us to set the precedence of just safely checking if an attribute is accessible and do an early return if not, independent of the reason that field might not be accessible. Also, apologies - I had thought the last commit included an adjustment I made swapping it from |
||
return InspectorMessage(message="Please include a unique cell_id associated with this IntracellularElectrode.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason you are setting this up as a cron job instead of just adding it to the PR triggered workflow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiplicity - If I include it in the main workflow we'd have (number of platforms) x (number of Python versions) x (number of PyNWB versions), which gets a bit out of hand.
This instead constrains to
ubuntu-latest
+ Python 3.9 and then goes back as far in the version history as desired.