Using this as a reference, these sound OK, with the exception of "have to" but only because repeating "have" twice like that sounds a bit jarring.
I ought to have finished the homework by the end of the week.
I have to have finished the homework by the end of the week.
I shall have finished the homework by the end of the week.
I have heard this before, it sounds a bit awkward but makes sense.
I had better (typically "I'd better") have finished the homework by the end of the week.
I have also heard this before, it sounds quite awkward but still makes a bit of sense.
I have got to (typically "I've got to") have finished the homework by the end of the week.
This ...
I must have finished the homework by the end of the week.
I must not have finished the homework by the end of the week.
sounds like you are just discovering you have or have not done the homework, rather than using "must" to communicate a requirement or obligation.
However, usually all these sentences are arranged like this, which sounds much more natural to me.
I ought to have the homework finished by the end of the week
And all the modals "work", including the ones not mentioned above, if you keep the sentence like that:
I can(n't)/could(n't)/must(n't)/might (not)/may (not) have the homework finished by the end of the week.
(Even though "I must not have the homework finished by the end of the week" - meaning I am required to not have my homework finished by the end of the week - is a peculiar situation to be in - that would be the right way to say it.)
As commented by Catija, the first three sentences are perfectly OK and as to the last one, the simple present tense is actually the correct usage.
According to grammar, when you are talking about the future, you should use the present simple in the time (when) clause, not a future form. For example, I'll come when I finish my work. So the correct sentence is:
I want to spend a year travelling when I finish university.
(Reference: The Free Dictionary - the use of "when").
Best Answer
I think that the best way to express what you are trying to say is, "I hope that this pandemic will end by July" or "I would like this pandemic to end by July". Both sentences express the idea that you are hoping that when we get to the month of July, the pandemic will be over. You could be even shorter: "I hope this is over by July!"