Skip to content
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

Tests are run twice. #60

Closed
Xiaoy312 opened this issue Nov 24, 2022 · 4 comments · Fixed by #68
Closed

Tests are run twice. #60

Xiaoy312 opened this issue Nov 24, 2022 · 4 comments · Fixed by #68
Labels
kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification.

Comments

@Xiaoy312
Copy link
Contributor

when using a separate assembly for tests and said assembly name ends with "tests",
the tests are run twice.

var testAssembliesTypes =
	from asm in AppDomain.CurrentDomain.GetAssemblies()
	where asm.GetName()?.Name?.EndsWith("tests", StringComparison.OrdinalIgnoreCase) ?? false
	from type in asm.GetTypes()
	select type;

var types = GetType().GetTypeInfo().Assembly.GetTypes().Concat(testAssembliesTypes);

^ AppDomain.CurrentDomain.GetAssemblies() definitely contains GetType().GetTypeInfo().Assembly.GetTypes()

@Xiaoy312 Xiaoy312 added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification. labels Nov 24, 2022
@Xiaoy312
Copy link
Contributor Author

		var testAssemblies = AppDomain.CurrentDomain.GetAssemblies()
			.Where(x => x.GetName()?.Name?.EndsWith("Tests", StringComparison.OrdinalIgnoreCase) ?? false)
			.Concat(new[] { GetType().GetTypeInfo().Assembly })
			.Distinct();
		var types = testAssemblies.SelectMany(x => x.GetTypes());

@jeromelaban
Copy link
Member

jeromelaban commented Nov 24, 2022

Interesting, this would mean we have a similar issue inside of Uno.UI. (unless there's a distinct somewhere after as well)

@Xiaoy312
Copy link
Contributor Author

Xiaoy312 commented Nov 24, 2022

In uno.ui, this is avoided because the UnitTestsControl is in the SampleApps, so the GetType().GetTypeInfo().Assembly (SampleApp assembly) there contains no tests. And, the tests are in Uno.UI.RuntimeTests (separate assembly).
So there is no double inclusion there.

@jeromelaban
Copy link
Member

Makes sense!

@Xiaoy312 Xiaoy312 mentioned this issue Dec 8, 2022
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants