This issue concerns automated testing in contrib. I hope I'm on the right tracker.
Feeds contains integration tests with a series of other contrib modules (Views, CCK, Data, Filefield, Date, more to come). These modules aren't strictly a dependency, but the tests nevertheless fail if these modules aren't in the site's search path.
I don't want these tests not make fail if they can't be found. This would defeat the purpose of tests in the first place.
From what I understand is that the test bot will use .info file information for determining dependencies - which clearly wouldn't suffice in this case. Do you have any plans to address the case of such 'soft dependencies' in tests?
Comment | File | Size | Author |
---|---|---|---|
#51 | project_dependency.test_dependencies_698932_51.patch | 4.16 KB | rfay |
#33 | project_dependency.test_dependencies.patch | 1.95 KB | rfay |
#19 | 698932-dependencies.patch | 4.53 KB | boombatower |
#18 | 698932-dependencies.patch | 1.98 KB | boombatower |
Comments
Comment #1
boombatower CreditAttribution: boombatower commentedWe need to determine a way to do d7 style dependencies with version information, I don't see a reason why we couldn't add soft dependencies at the same time, they can be treated virtually the same by the testing system and just completely ingored by Drupal itself.
#102102: Parse project .info files: present module list and dependency information
Comment #2
boombatower CreditAttribution: boombatower commentedExample of simple 6.x style .info file.
with 7.x style dependency information (also used as soft dependencies)
Then of course the same can hold true for Drupal 7, but the soft_dependencies will have a dual meaning in 6.x. They will add/override detail of regular dependencies and add soft dependencies that are ignored by drupal, but used by testing system.
So in the example above, both the soft_dependencies would be downloaded by the testing system, but the version restriction would be used for myothermodule instead of the plain entry.
Comment #3
jhodgdonI am not sure if I like the name "soft_dependencies", since I had to ask boombatower in IRC what it meant. :)
How about test_dependencies or simpletest_dependencies?
Comment #4
jhodgdonBut I like the concept, I should add.
Comment #5
boombatower CreditAttribution: boombatower commentedAfter discussing in IRC and looking for core documentation, jhodgdon found:
http://drupal.org/node/542202
http://api.drupal.org/api/function/drupal_parse_dependency/7
Comment #6
boombatower CreditAttribution: boombatower commentedoutputs
which seems like about all will be useful from d7, since the system will need to find the -dev version that fits that criteria. I assume we'll just start form the latest and work our way down until a -dev fits those criteria. Use current algorithm if no version information specified.
The remaining question is, what to do if no release could be found. I'm thinking we cause a build error?
Comment #7
boombatower CreditAttribution: boombatower commentedIf a specific version is specified, like (2.0) I guess we'll just look for that specific release, otherwise always shoot for the highest dev version that meats the restrictions.
Comment #8
boombatower CreditAttribution: boombatower commentedThis code seems to do the trick (adapted from http://api.drupal.org/api/function/drupal_check_incompatibility/7).
Comment #9
boombatower CreditAttribution: boombatower commentedRevised example from above:
Drupal 6.x
Drupal 7.x
Comment #10
jhodgdonThis may apply to the 7.x system as well as 6.x, but is it possible to specify that you want specifically 2.x and not 3.x? I think when I looked at the code for version checking in 7.x, it would accept 3.x as a substitute for 2.x. That will not always work (sometimes module developers change APIs from version to version in incompatible ways, and the module could break).
Comment #11
boombatower CreditAttribution: boombatower commented>=2.x works for all 2.x and 3.x, (2.x) is only 2.1,2.2, no 3.x.
Comment #12
jhodgdonOK, then I'm in favor of the .info structure you proposed in #9 and clarified in #11.
Comment #13
jhodgdonYou may also be interested in this issue on Simpletest: #699216: Module dependencies not being checked in SimpleTest 6.x (and needs doc)
Basically, the 6.x version of SimpleTest is not checking dependencies for tests. I guess it's only peripherally related to this issue, but...
Comment #14
Dave ReidWhy do we need a separate .info dependencies when we already have them in the getInfo() function. Seems like unnecessary duplicate to me. :/
Comment #15
jhodgdonI don't think getInfo() can specify versions of modules.
Comment #16
Dave ReidWe could and easily extend it to use the same format as the .info file syntax. I guess it's easier to parse in PIFR if it's all in .info file.
Comment #17
boombatower CreditAttribution: boombatower commentedThis information may also exist outside of tests.
Comment #18
boombatower CreditAttribution: boombatower commentedThis should be all that is needed once the parsing patch is in.
Comment #19
boombatower CreditAttribution: boombatower commentedActually, should update test as well.
Comment #20
sun#1023220: Tests enable extra, unrelated modules (and more) has been marked as duplicate of this issue...
Comment #21
rfayIt's my opinion that dependencies in tests should be the next push once we get current code deployed and stable.
Comment #22
bfroehle CreditAttribution: bfroehle commentedsubscribe
Comment #23
plachComment #24
rfayIRC conversation with boombatower:
Comment #25
rfayWe now have the ability to download dependencies, so time to take this up again. First the stuff in project_dependency will have to be updated for this.
Comment #26
Dane Powell CreditAttribution: Dane Powell commentedAre there currently any workarounds for this?
I maintain the Mailhandler module, which has a test that runs Coder Review. Obviously Coder isn't a hard dependency, but I'd really like the automated test bots to be able to run the test...
Comment #27
sloame CreditAttribution: sloame commentedOk, so is the soft dependency feature implemented? How do I use it to test a patch?
I wrote a patch for the fivestar module, but can get it to pass the tests via the testbot(http://qa.drupal.org/pifr/test/203748). On my local installation it does pass the tests.
The issue, i think is fivestar's test case class extending the AJAXTestCase class. The AJAXTestCase then requires the 'ajax_test' and 'ajax_forms_test' modules to be enabled, which fails because fivestar doesn't include those modules as dependencies(which is right, because it doesn't need/depend on them).
ericduran(one of the maintainers of fivestar) has an issue related to this in http://drupal.org/node/1334506, but there has been no response so far on that.
Comment #28
BerdirAdd a 'dependencies' => array('ajax_test', 'ajax_forms_test') definition to the getInfo() method. This isn't a fix, but it will prevent the testbot from executing tests which are doomed to fail anyway.
Comment #29
sloame CreditAttribution: sloame commentedThanks for the response.
I'm still lost here. Do you mean i should change the lines below:
to
in the fivestar.test file. If so, would that mean that i'll have to patch that file or how does my changes get to the testbot?
Comment #30
BerdirYes, exactly.
This enforces that a test class is only executed if the necessary dependencies are met. And yes, you need to patch the module to do this, either as part of your patch or in a separate issue.
Obviously, if this is the only test case, this means that testbot won't run anything. But maybe you can move the test cases which require ajax_test into a separate class, if there are actually some that don't require it.
Comment #31
Dane Powell CreditAttribution: Dane Powell commentedActually the 'workaround' I've used for this is to move features with soft dependencies into submodules with hard dependencies. Architecturally I think this is actually a better design anyway.EDIT: Nevermind, this doesn't actually work unless the main module is dependent on the submodule...
Comment #32
rfayMoving over to Project Dependency, as its calculations are what determines what modules are loaded.
Comment #33
rfayI think this patch gets the ball rolling. It parses the test_dependencies in the info file (I haven't experimented with this yet) and puts them into the database. The next thing that has to be accomplished is to have the actual dependency generation (at request time) take into account these requirements. I think this will require some signature changes to a couple of functions, and it may very well be that we should change the dependency type to a mask (or maybe a string).
Comment #34
boombatower CreditAttribution: boombatower commentedThis was all part of the original patch...I get more and more confused the more I read these issues. All the goods were dropped and the structure changed so it didn't fit in project....meh.
Comment #35
Dane Powell CreditAttribution: Dane Powell commentedFYI here is a similar issue in the testbot issue queue: #1347790: Specify dependency overrides on the Automated Testing tab
Comment #36
trobey CreditAttribution: trobey commentedI have posted a proposal to allow dependency overrides on #1347790: Specify dependency overrides on the Automated Testing tab, comment #3.
One problem I see with specifying test dependencies in the .info file is it is the wrong scope. If the information pertains to testing it should appear there and not at the module scope (if possible). It is the equivalent of using a global variable when a local variable would suffice.
Comment #37
boombatower CreditAttribution: boombatower commentedBut the approach in the other issues makes it specific to d.o which is silly. We need less of that, much less. It is just like module dependencies only these are more like "recommends" from the linux packaging world aka things I integrate with so I obviously need them during testing to see if I integrate well. If we really don't want to put in the .info file...great but then with the .test files or somewhere within the code tree. Frankly I think we should just leave them in .info files.
Comment #38
MegaChriz CreditAttribution: MegaChriz commentedI agree with boombatower, the .info-file is a better idea than a field on drupal.org. That way, if you download a module for testing, you can easily see which projects it needs to run those tests. Else you would have go to the automated tests tab to gain that information (or examine the code). Another benefit is that you can patch an automated test with an extra soft dependency (although this may hardly occur).
I also like the (striked through) idea of Dane Powell in #31: that you add a specific test module which lists all dependencies. (I already tried that with Ubercart Addresses, figured why that didn't work, and then I saw Dane's comment was striked through.)
Comment #39
BerdirThe hidden test module trick should work fine, you just need to give it some time to rebuild the dependencies, which usually happens when a new -dev snapshot is built. There is no need for the main module to depend on the hidden one. I have multiple projects which have optional modules that have external dependencies and that works just fine.
There is no requirement to have a "main module" that is named like the project and that would be the only way to detect that a module is the main one. Pretty sure that the dependency builder script looks at all modules in a project.
Comment #40
MegaChriz CreditAttribution: MegaChriz commented@Berdir,
Well, in case of Ubercart Addresses 7.x-1.x that didn't work. I had added a hidden module in a subfolder called 'tests' and (some of) the dependencies noted there are not loaded (for example rules). Not even after other commits and several rebuild snapshots. Or did I something wrong?
http://drupalcode.org/project/uc_addresses.git/blob/4170010c4162b94e2a5d...
Comment #41
rfay@MegaChriz, please file an issue when you have a specific problem.
Followups about dependencies on the Automated testing tab should be over in #1347790: Specify dependency overrides on the Automated Testing tab
I don't support doing dependency overrides instead of .info file dependency generation, but I do support it as an override technique.
Comment #42
bforchhammer CreditAttribution: bforchhammer commentedThis doesn't work for me, see #1670936: Testbot does not detect/download additional dependencies.
Comment #43
lucascaro CreditAttribution: lucascaro commented@MegaChriz I think I have the same problem. Did you file a new issue? did you find out how to fix it?
Comment #44
MegaChriz CreditAttribution: MegaChriz commented@lucascaro
No, I didn't filed an issue about it, because sometime later all automated tests of Ubercart Addresses suddenly got executed by the testbot. At first, I thought somebody who watched this issue had fixed it for me without notifying me, but later (and now) I guess dependencies of dependency projects are picked up now by the testbot (correct me if I'm wrong), as I only listed dependencies in the hidden module that already were dependencies of Ubercart or the Ubercart Addresses main module. Because I could no longer demonstrate the problem, I saw no point in opening an issue about it afterwards (and maybe also because I forgot to do something with this issue).
Comment #45
trobey CreditAttribution: trobey commented@MegaChriz
I believe it was #1507650: "Failed to check out": Internal dependencies not followed properly within a project (extra dependency) that solved your problem.
Comment #46
lucascaro CreditAttribution: lucascaro commentedWell, as I'm having a similar problem (the bot doesn't pick up the dependencies) I've created an issue at: #1712656: Dependencies for modules are not updated....
Comment #47
rfayComment #48
hass CreditAttribution: hass commentedCame here from #1804716: Setup optional modules fails -> patch review fails and asking me if this feature may go in soon. This case is open for nearly 2 years. What are we waiting for?
Comment #49
rfayThe patch in this issue has never been tried out.
There may be existing code now in the module that would support this if tested.
We're just waiting for somebody to push this one through. It would certainly be helpful for @hass's case.
Right now is a fairly unsuitable time to work on any of this stuff because of the pending D7 move. At least that's my line.
Comment #50
rfayThe patch in #33 probably gets us pretty close to in range. We could also just add the test_dependencies to the regular list of dependencies.
Comment #51
rfayI think this one will do the job. It's based on #33, but there are a few more details that were required.
This adds "dependency_type" handling (required or recommended). It will require changes to PIFT to be useful.
Note that we *could* just add test_dependencies found in the info file to the regular dependencies and process them the same. This would work fine for the testbots (and then would require no pift changes), but might cause problems for other potential future uses of this information.
Comment #52
rfayCommitted to 6.x-1.x in http://drupalcode.org/project/project_dependency.git/commitdiff/952e481
Moving to 7.x
Comment #53
rfayComment #54
hass CreditAttribution: hass commented#1833154: Enable optional token tests on d.o. It fails. Custom variable tests are all skipped.
Comment #55
rfayPlease see #1804716-22: Setup optional modules fails -> patch review fails for information.
Comment #56
rfayPorted to D7 and committed in http://drupalcode.org/project/project_dependency.git/commitdiff/5ee8fcf